实时异常"2147217900(80040e14)"From子句语法异常(急)
实时错误"-2147217900(80040e14)"From子句语法错误(急!!!)
Private Sub cmd_ok_Click()
If txtusername.Text = " " Then
MsgBox "你的输入姓名为空,请重新输入。 "
txtusername.SetFocus
ElseIf txtpassword.Text = " " Then
MsgBox "你的输入密码为空,请重新输入。 "
txtpassword.SetFocus
Else
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strconn As String
Dim sql As String
strconn = "provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\studata.mdb;Persist Security Info=False "
conn.Open strconn
conn.CommandTimeout = 20
sql = "select * from user where user_name= ' " & txtusername.Text & " 'and user_pass= ' " & txtpassword.Text & " ' "
rs.Open sql, conn, adOpenKeyset, adLockOptimistic
If Not rs.EOF Then
Me.Hide
frmMain.Show
Else
MsgBox "你的输入有错误,请重新输入。 "
txtusername.Text = " "
txtpassword.Text = " "
txtusername.SetFocus
End If
End If
End Sub
请大家帮我看看这段代码那儿出错了?谢谢!
------解决方案--------------------
sql = "select * from [user] where user_name= ' " & txtusername.Text & " 'and user_pass= ' " & txtpassword.Text & " ' "
user是关键字
Private Sub cmd_ok_Click()
If txtusername.Text = " " Then
MsgBox "你的输入姓名为空,请重新输入。 "
txtusername.SetFocus
ElseIf txtpassword.Text = " " Then
MsgBox "你的输入密码为空,请重新输入。 "
txtpassword.SetFocus
Else
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strconn As String
Dim sql As String
strconn = "provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\studata.mdb;Persist Security Info=False "
conn.Open strconn
conn.CommandTimeout = 20
sql = "select * from user where user_name= ' " & txtusername.Text & " 'and user_pass= ' " & txtpassword.Text & " ' "
rs.Open sql, conn, adOpenKeyset, adLockOptimistic
If Not rs.EOF Then
Me.Hide
frmMain.Show
Else
MsgBox "你的输入有错误,请重新输入。 "
txtusername.Text = " "
txtpassword.Text = " "
txtusername.SetFocus
End If
End If
End Sub
请大家帮我看看这段代码那儿出错了?谢谢!
------解决方案--------------------
sql = "select * from [user] where user_name= ' " & txtusername.Text & " 'and user_pass= ' " & txtpassword.Text & " ' "
user是关键字