我不知道如何转换此代码。
此代码用于子主
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.. 文本文件...