我写的vb连接远端sql代码有错误吗?
我就在form1上添加了一个command控件,想通过点击否弹出的对话框来判断时候可以连接.但是调试的时候总是提示语句错误.就是那句 "adoConnection.Open"Private Sub Command1_Click()
Dim adoConnection As New Connection
adoConnection.ConnectionString = "provider=sqloledb.1;" & _
"user id=sa;initial" & _
"catalog=学生成绩数据库;data" & _
"source=222.17.181.113;"
adoConnection.Open
If adoConnection.State = adStateOpen Then
MsgBox "connection to database successful!"
Else: MsgBox "unsuccessful!"
End If
End Sub