microsoft[ODBC SQL Server Driver][SQL Server]在关键字“user”处有语法错误
Private Sub Command1_Click()Dim strQL As String
If Text1.Text = " " Then
MsgBox "用户名不能为空", 0, "警告"
Text1.SetFocus
Exit Sub
End If
openDB
strQL = "select * from user where 用户名='" + Trim(Text1.Text) + "'"
objRs.Open strQL, objConn, adOpenDynamic, adLockOptimistic If objRs.EOF Then
MsgBox "用户名不存在", 0, "警告"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
objRs.Close
closeDB
Exit Sub
Else
If Trim(Text2.Text) = Trim(objRs.Fields(1).Value) Then
currentuser = Trim(Text1.Text)
Form2.Show
objRs.Close
closeDB
Logged = True
Unload Me
Else
objRs.Close
closeDB
MsgBox "密码不正确", 0, "警告"
Text2.Text = ""
Text2.SetFocus
End If
End If
End Sub --------------------编程问答-------------------- strQL = "select * from [user] where 用户名='" + Trim(Text1.Text) + "'"
--------------------编程问答-------------------- 使用数据库保留字要加[] --------------------编程问答-------------------- 如果回答的是你错误的原因,请及时结贴。
--------------------编程问答-------------------- user是sql关键字 需要[]
--------------------编程问答-------------------- 已经回答了
补充:VB , 数据库(包含打印,安装,报表)