今天拿 purana 的程序来学习
调试的时候出了这样一个错误
信息如下
“实时错误 '-2147217900 (80040e14) '
FROM 子句语法错误” 下面代码红色部分,不是那样写的吗?
;下面是详细代码
Private Sub Form1_Load()
Option Explicit
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
End Sub
Private Sub CmdOK_Click()
Dim ConStr As String
If TxtUserName.Text = "" Then
MsgBox "请输入用户名!", vbOKOnly + vbExclamation, "登陆信息错误"
TxtUserName.SetFocus
Exit Sub
End If
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\ttj02.Mdb"
cn.Open ConStr
cn.CursorLocation = adUseServer
rs.Open "Select * from user", cn, adOpenKeyset, adLockPessimistic
If rs.RecordCount > 0 Then
If TxtUserName.Text <> "" Then
Set rs1 = New ADODB.Recordset
rs1.Open "Select * From user Where User_nb= '" & TxtUserName.Text & "'", cn, adOpenKeyset, adLockPessimistic
If rs.RecordCount > 0 Then
If TxtPassWord.Text <> "" Then
If rs.Fields("User_Nb") = TxtUserName.Text And rs.Fields("User_password") = TxtPassWord.Text And rs.Fields("User_name") = Cbop.Text Then
FrmMain.Show
rs1.Close
Unload Me
Else
If rs1.Fields("User_password") <> TxtPassWord.Text Then
MsgBox "密碼錯誤,請與管理員聯系!", vbCritical + vbOKOnly, "密碼錯誤"
TxtPassWord.SetFocus
TxtPassWord.SelStart = 0
TxtPassWord.SelLength = Len(TxtPassWord.Text)
Exit Sub
Else
If rs1.Fields("User_Popedom") <> Cbop.Text Then
MsgBox "權限錯誤,請與管理員聯系!", vbOKOnly + vbCritical, "權限錯誤"
Cbop.SetFocus
Exit Sub
End If
End If
End If
Else
MsgBox "請輸入密碼!", vbOKOnly, "登錄"
TxtPassWord.SetFocus
Exit Sub
End If
Else
MsgBox "沒有該用戶,請與管理員聯系!", vbOKCancel + vbExclamation, "登錄"
Exit Sub
End If
End If
Else
MsgBox "沒有用戶信息,請確定!", vbExclamation + vbOKCancel, "登錄"
TxtUserName.SetFocus
Exit Sub
End If
rs.Close
End Sub
[此贴子已经被作者于2006-3-3 20:44:37编辑过]