中国石凳联盟 登录注册

论坛转换程序(ESOU to 6KBBS)

rockage··3 回复·383 浏览

发表回复

Dim newbbs As New ADODB.Connection
Dim oldbbs As New ADODB.Connection
Dim rstQuery As New ADODB.Recordset
Dim SQLQuery As String
市场是一种理性和感性的搀杂物,它的表象时常是错误的,而投资的秘诀就在于当价格远远低于内在价值时投资,等待市场对其错误的纠正


Private Sub Command1_Click()


Dim olduser As New ADODB.Recordset
Dim userinfo As String


SQLQuery = "select * from cpb_user order by f_id" for okok
olduser.CursorLocation = adUseClient
olduser.Open SQLQuery, oldbbs, adOpenKeyset, adLockPessimistic
olduser.MoveFirst



zymzeng@163.com│http://www.6kbbs.net│1985-08-27│70767766│1│http://www.6kbbs.net/images/me.jpg│100│120│http://www.6kbbs.net

http://www.6kbbs.com│2004-7-12│



rockage@tom.com│http://www.rockage.com│1978-05-09│122590│1│images/headpic/10.gif│70│120│rock
you rock me│2007-8-2│





SELECT , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
FROM cpb_user


平等 自由 公开


Do


olduser("f_lastlogin")
userinfo = olduser("f_email") "│" olduser("f_home") "│" olduser("f_birder") "│" olduser("f_qq") "│1│" olduser("f_imghead") "│" olduser("f_imgwidth") "│" olduser("f_imgheight") "│" olduser("f_sign") "│" olduser("f_regtime") "│"


SQLQuery = "INSERT INTO user2(, , , , , , , ) " _
"VALUES " _
"(" olduser("f_username") "," olduser("f_password") "," userinfo ",50,0," olduser("f_replytopic") ",2007-8-1 13:01:01,0)"


SQLQuery = "INSERT INTO user(, , , , , , ) VALUES (山枫点火,e6f3ea0661ebaa77,fengyatou168@sohu.com,50,0,0,2007-8-2 0:18:02)"


SQLQuery = "INSERT INTO user(name) VALUES (山枫点火)"


SQLQuery = "select * from users"


newbbs.Execute SQLQuery


olduser.MoveNext
Loop Until olduser.EOF
Text1.Text = SQLQuery
MsgBox "ok"


End Sub


Private Sub Command2_Click()
平等 自由 公开
www.jd0768.com


Dim olduser As New ADODB.Recordset
Dim olduserid As New ADODB.Recordset
Dim topicinfo As String
Dim userid As String


SQLQuery = "select * from cpb_topic order by f_id" for okok
olduser.CursorLocation = adUseClient
olduser.Open SQLQuery, oldbbs, adOpenKeyset, adLockPessimistic
olduser.MoveFirst


SELECT , , , , , , , , , ,
FROM topic
topicinf face1│need a hand?│admin│
------------------------------------------------


SELECT , , , , , , , , , ,
, , , , , , , , ,
, , , , , , , ,
FROM cpb_topic





Dim progress As Long
progress = 0
Do


If olduser("f_time") = "2003-9-24 13:30:59" Then Stop


Dim i As Integer, s As String, ss As String, needt As Integer
i = 0
s = ""
needt = 0
Do
i = i + 1
ss = Mid(olduser("f_title"), i, 1)

If ss = "" Then needt = 1
If needt = 1 Or needt = 2 Then
Select Case ss
Case "a"
ss = ""
i = i + 3
needt = 0
Case "n"
ss = " "
i = i + 4
needt = 0
Case "l"
ss = ""
i = i + 2
needt = 0
Case "r"
ss = ""
i = i + 2
needt = 0
Case ""
needt = 2
End Select
End If





If ss "" And needt = 0 Then
s = s ss
End If

Loop Until i = Len(olduser("f_title"))





topicinfo = "face1│" s "│" olduser("f_username") "│"
bd = olduser("f_bbsid")
renum = olduser("f_reply")
hits = olduser("f_hits")
edittime = olduser("f_time")


SQLQuery = "select userid from user2 where name = " olduser("f_username") ""

If olduserid.State 0 Then olduserid.Close
olduserid.CursorLocation = adUseClient
olduserid.Open SQLQuery, newbbs, adOpenKeyset, adLockPessimistic
If olduserid.RecordCount = 1 Then
userid = olduserid("userid")
Else
userid = 1
End If


SQLQuery = "INSERT INTO topic(, , ,,,,,) " _
"VALUES " _
"(" userid "," topicinfo "," bd "," renum "," hits "," edittime ",1," s ")"


progress = progress + 1
Me.Caption = progress
DoEvents


newbbs.Execute SQLQuery



SELECT , , , , , , , ,
FROM bbs1
face1│need a hand?│admin││test test test│2007-8-3 21:48:41
bbsid = 自增
id = ?
bid = 主题id
bd=版面id


------------------------------------------------


content = "face1│" s "│" olduser("f_username") "││" olduser("f_content") "│" olduser("f_time")


Dim tquery As New ADODB.Recordset


SQLQuery = "select TOP 1 id from topic order by id desc"

If tquery.State 0 Then tquery.Close
tquery.CursorLocation = adUseClient
tquery.Open SQLQuery, newbbs, adOpenKeyset, adLockPessimistic


SQLQuery = "INSERT INTO bbs1(,,,,) " _
"VALUES " _
"(" tquery("id") "," userid "," content "," bd "," edittime ")"

On Error Resume Next
newbbs.Execute SQLQuery


olduser.MoveNext
Loop Until olduser.EOF
Text1.Text = SQLQuery
MsgBox "ok"


End Sub


Private Sub Command3_Click()



Dim olduser As New ADODB.Recordset
Dim olduserid As New ADODB.Recordset
Dim content As String
Dim bbsid As String
Dim userid As String
Dim bid As String


SQLQuery = "select * from cpb_reply order by f_id" for okok
olduser.CursorLocation = adUseClient
olduser.Open SQLQuery, oldbbs, adOpenKeyset, adLockPessimistic
olduser.MoveFirst


SELECT , , , , , , , ,
FROM bbs1
face1│need a hand?│admin││test test test│2007-8-3 21:48:41
bbsid = 自增
id = ?
bid = 主题id
bd=版面id


------------------------------------------------
SELECT , , , , , , , , , ,
FROM cpb_reply
Dim progress As Long
progress = 0



Do
查询bid 开始
Dim oldtid As New ADODB.Recordset
SQLQuery = "select f_title from cpb_topic where f_id = " olduser("f_topicid")
If oldtid.State 0 Then oldtid.Close
oldtid.CursorLocation = adUseClient
oldtid.Open SQLQuery, oldbbs, adOpenKeyset, adLockPessimistic
oldtid.MoveFirst

Dim oldtid2 As New ADODB.Recordset
SQLQuery = "select top 1 id from topic where test = " oldtid("f_title") ""
If oldtid2.State 0 Then oldtid2.Close
oldtid2.CursorLocation = adUseClient
oldtid2.Open SQLQuery, newbbs, adOpenKeyset, adLockPessimistic
oldtid2.MoveFirst
bid = oldtid2("id")
----------end of bid query--------
SQLQuery = "select userid from user2 where name = " olduser("f_username") ""

If olduserid.State 0 Then olduserid.Close
olduserid.CursorLocation = adUseClient
olduserid.Open SQLQuery, newbbs, adOpenKeyset, adLockPessimistic
If olduserid.RecordCount = 1 Then
userid = olduserid("userid")
Else
userid = 1
End If
---------end of userid query----------
------------------------------------------------
face1││rockage││efwffffewwwwwwwwwwwwwww│2007-8-4 5:30:05


content = "face1││" olduser("f_username") "││" olduser("f_content") "│" olduser("f_time")


bd = olduser("f_bbsid")
edittime = olduser("f_time")


SQLQuery = "INSERT INTO bbs1(,,,,) " _
"VALUES " _
"(" bid "," userid "," content "," bd "," edittime ")"

On Error Resume Next
newbbs.Execute SQLQuery
progress = progress + 1
Me.Caption = progress
DoEvents


olduser.MoveNext
Loop Until olduser.EOF
Text1.Text = SQLQuery
MsgBox "ok"





End Sub


Private Sub Form_Load()
Dim pstr As String, strPath As String Open ADO 数据库
strPath = App.Path "" "stoneren.mdb"
pstr = pstr "Provider=Microsoft.Jet.OLEDB.4.0"
pstr = pstr "Persist Security Info=False"
pstr = pstr "Data Source=" strPath "Jet OLEDB:Database Password="
oldbbs.Open pstr


strPath = App.Path "" "6kbbs.mdb"
pstr = pstr "Provider=Microsoft.Jet.OLEDB.4.0"
pstr = pstr "Persist Security Info=False"
pstr = pstr "Data Source=" strPath "Jet OLEDB:Database Password="
newbbs.Open pstr


End Sub










点赞0 收藏
又见通宵,基本完工,为了对付潜在的问题,放上源代码,回公司再整了
点赞0 收藏
注释看球不明
Being a devil is the same as being a human. We should be kind. If we are kind, we are not a devil, we are a hybrid.
点赞0 收藏
这是我转换的最复杂的论坛,两个论坛差别太大了,在esou里,字段是独立的,而在6k里,字段是用 符号连接的,第一步要将esou里的独立字段抽取出来再用合成。 还有在esou里用的是转义符号,比如隔开每个项目),所以在确定主键的时候就恼火了,最后没办法只能创建一个临时表先把独立字段分散,然后用程序合并导入,再根据之前的临时表记录确定主键,最后手工删除临时表。。。。。我郁闷!
点赞0 收藏
发表回复
发表回复