请帮我看看这个用户登录的代码哪错了!运行时提示FROM字句错误,我看不出来,请各位指教。
数据库为CIP.mdb,表user(username,password)Private Sub btnEnter_Click()
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim txtSQL As String
Dim i As Integer
If Trim(txtUser.Text) = "" Or Trim(txtPSW.Text) = "" Then
MsgBox "请输入用户名和密码!", vbOKOnly + vbInformation, "提示"
Exit Sub
End If
Conn.ConnectionString = adoPath & App.Path & DBName
Conn.Open
If i >= 3 Then
Unload Me
End If
txtSQL = "SELECT * FROM user where username='" & Trim(txtUser.Text) & "' and password='" & Trim(txtPSW.Text) & "'"
Set Rs = Conn.Execute(txtSQL)
If Rs.EOF Or Rs.BOF Then
MsgBox "用户名或密码错误,请重新输入!", vbOKOnly + vbInformation, "提示"
i = i + 1
txtUser.Text = ""
txtPSW.Text = ""
txtRe.Text = ""
txtUser.SetFocus
Exit Sub
End If
user_name = txtUser.Text
MDICIP.Show
Unload Me
Conn.Close
End Sub急啊,请大家帮帮忙!!!
数据库为CIP.mdb,表user(username,password)Private Sub btnEnter_Click()
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim txtSQL As String
Dim i As Integer
If Trim(txtUser.Text) = "" Or Trim(txtPSW.Text) = "" Then
MsgBox "请输入用户名和密码!", vbOKOnly + vbInformation, "提示"
Exit Sub
End If
Conn.ConnectionString = adoPath & App.Path & DBName
Conn.Open
If i >= 3 Then
Unload Me
End If
txtSQL = "SELECT * FROM user where username='" & Trim(txtUser.Text) & "' and password='" & Trim(txtPSW.Text) & "'"
Set Rs = Conn.Execute(txtSQL)
If Rs.EOF Or Rs.BOF Then
MsgBox "用户名或密码错误,请重新输入!", vbOKOnly + vbInformation, "提示"
i = i + 1
txtUser.Text = ""
txtPSW.Text = ""
txtRe.Text = ""
txtUser.SetFocus
Exit Sub
End If
user_name = txtUser.Text
MDICIP.Show
Unload Me
Conn.Close
End Sub急啊,请大家帮帮忙!!!
我曾经也遇到这样的问题!!要不就是字段和系统冲突