VB在连接SQL SERVER时出错.下面是我的代码:
Private Sub cmdLogin_Click()
UID = txtUserName.Text
PWD = txtPassword.Text
If db.ConnectionString <> "" Then
MsgBox "请先注销再登录!", , "登录"
Unload Me
Exit Sub
End If
db.ConnectionString = "Provider=SQLOLEDB.1;" & _
"persist security Info=false;" & _
"user ID=" & UID & _
"passward=" & PWD & _
";initial catalog=jxcdatabase;" & _
"Data Source=txd"
db.Open
在ODBC中我做了一个数据源,在"系统DSN"中有一个TXD数据源,在运行时,到了DB,OPEN
就不运行了,各位高手请问这是什么原因呀?
Private Sub cmdLogin_Click()
UID = txtUserName.Text
PWD = txtPassword.Text
If db.ConnectionString <> "" Then
MsgBox "请先注销再登录!", , "登录"
Unload Me
Exit Sub
End If
db.ConnectionString = "Provider=SQLOLEDB.1;" & _
"persist security Info=false;" & _
"user ID=" & UID & _
"passward=" & PWD & _
";initial catalog=jxcdatabase;" & _
"Data Source=txd"
db.Open
在ODBC中我做了一个数据源,在"系统DSN"中有一个TXD数据源,在运行时,到了DB,OPEN
就不运行了,各位高手请问这是什么原因呀?
UID = txtUserName.Text
PWD = txtPassword.Text
If db.ConnectionString <> "" Then
MsgBox "请先注销再登录!", , "登录"
Unload Me
Exit Sub
End If
'少了一个分号.
db.ConnectionString = "Provider=SQLOLEDB.1;" & _
"persist security Info=false;" & _
"user ID=" & UID & _
";passward=" & PWD & _
";initial catalog=jxcdatabase;" & _
"Data Source=txd"
db.Open