Dim rs As ADODB.Recordset
Dim cn As New ADODB.Connection '* 数据库连接
Set rs = New ADODB.Recordset '* 数据库记录
Dim str As String
Dim yonghu As String
yonghu = frmmain.enter.Caption
cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\user.mdb"
str = "select * from information where username='" & yonghu & "'"
On Error Resume Next
If Text1.Text = rs.Fields("key") Then
MsgBox "确认成功!"
Text1.Text = ""
Me.Hide
frmcorrect.Show
ElseIf Text1.Text <> rs.Fields("key") Then
MsgBox "密码输入有误!"
End If
Dim cn As New ADODB.Connection '* 数据库连接
Set rs = New ADODB.Recordset '* 数据库记录
Dim str As String
Dim yonghu As String
yonghu = frmmain.enter.Caption
cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\user.mdb"
str = "select * from information where username='" & yonghu & "'"
On Error Resume Next
If Text1.Text = rs.Fields("key") Then
MsgBox "确认成功!"
Text1.Text = ""
Me.Hide
frmcorrect.Show
ElseIf Text1.Text <> rs.Fields("key") Then
MsgBox "密码输入有误!"
End If
Dim cn As New ADODB.Connection '* 数据库连接
Set rs = New ADODB.Recordset '* 数据库记录
Dim str As String
Dim yonghu As String
yonghu = frmmain.enter.Caption
cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\user.mdb"
str = "select * from information where username='" & yonghu & "'"
On Error Resume Next '蛋疼的错误处理,永远都无法发现错误
If Text1.Text = rs.Fields("key") Then
MsgBox "确认成功!"
Text1.Text = ""
Me.Hide
frmcorrect.Show
ElseIf Text1.Text <> rs.Fields("key") Then
MsgBox "密码输入有误!"
End If
str = "select * from information where username='" & yonghu & "'"
if rs.state<>adstatecloed then rs.close
rs.open str,cn,adopenkeyset,adlockreadonly
如果用户输入 ' or username<>'你说会怎么样?