0
我不知道如何轉換此代碼。
轉換代碼vb 6到vb.net
此代碼爲副主
Public Sub main()
On Error Resume Next
frmsplash.Show
Open App.Path & "/joel.txt" For Input As #1
Input #1, serverhost
Input #1, mydatabasename
Input #1, myusername
Input #1, mypassword
Input #1, mysqlport
Close #1
cn.ConnectionString = "Driver={MySQL ODBC 5.1 Driver};Server=" & Trim(serverhost) & ";Port=" & Trim(mysqlport) & ";Database=" & Trim(mydatabasename) & "; User=" & Trim(myusername) & ";Password=" & Trim(mypassword) & ";Option=3;"
cn.Open
If cn.State = 0 Then
MsgBox "Unable to connect to database", vbCritical
frmconnect.Show
frmsplash.Hide
Exit Sub
這個代碼創建連接
Private Sub cmdcreate_Click()
Open App.Path & "\joel.txt" For Output As #1
Print #1, txtserver.Text
Print #1, txtschema.Text
Print #1, txtuser.Text
Print #1, txtpassword.Text
Print #1, txtport.Text
Close #1
Unload Me
Call main
End Sub
我嘗試創建一個連接字符串.. submain ..文本文件...
你有什麼嘗試,特別是你堅持什麼位?不是轉換代碼,而是通過實際學習語言並在更適合平臺的結構中進行重寫。 – Deanna 2013-03-12 16:53:56
我將該代碼轉換爲vb.net,但出現錯誤... – 2013-03-12 16:56:43
什麼錯誤?在哪些代碼上? – Deanna 2013-03-12 23:59:10