帮帮忙吧 在登陆的时候,对于用户名的字母大小写不敏感,但对密码敏感,下边是我的代码,有哪位大虾帮我看看吧
急啊 谢谢啊
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub Command1_Click()
Dim str As String
Set cn = New ADODB.Connection
cn.ConnectionString = "provider=sqloledb.1;data source=(local);user id=sa;pwd=623058;initial catalog=sdb"
cn.Open
str = "select * from Users where UserName='" & Trim(Text1.Text) & "'"
Set rs = New ADODB.Recordset
rs.Open str, cn, adOpenStatic, adLockOptimistic
If rs.RecordCount > 0 Then
If rs.Fields("Pwd").Value = Trim(Text2.Text) Then
MsgBox "successful"
Command3.Enabled = True
Else
MsgBox "密码错误"
Text2.Text = ""
Text2.SetFocus
Command3.Enabled = False
End If
Else
MsgBox "无此用户"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Command3.Enabled = False
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub