第1个回答 2013-09-26
Dim rs As New ADODB.Recordset
Dim Conn As ADODB.Connection
Dim ConnectionString As String
Dim sql As String
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "用户名,密码 不能为空"
Else
Set Conn = CreateObject("ADODB.Connection")
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\love.mdb;Persist Security Info=False;"
Conn.Open ConnectionString
sql = "select * from denglu where 用户名='" & Text1.Text & "' and 密码='" & Text2.Text & "'"
rs.Open sql, Conn, 3, 3
If Not rs.EOF Then
Form2.Show'跳到转向的页面
Else
MsgBox "用户名或密码错误,请重新输入"
End If
第2个回答 2013-09-26
str="select * from user where txtuser='" & txtuser.text & "' and txtpass='" & txtpassward & "'"
recordset.open str,conn,1,1
if recordset.RecordCount>0 then
load yourform
else
msgbox
endif