Dim str As String
Dim datas As String = AppDomain.CurrentDomain.BaseDirectory + "App_Data\\data.mdb"
str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + datas
Dim conn As OleDbConnection
conn = New OleDbConnection(str)
conn.Open()
Dim strsql As String
Dim sql As String
strsql = "select * from utb where username='" & txtuser.Text & "' and password= '" & txtpwd.Text & "'"
Dim cmd As New OleDbCommand(strsql, conn)
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader
If (dr.Read) Then
Dim main As New main
main.ShowDialog()
me.Hide
Else
MsgBox("你输入的用户名或密码错误,请从新输入!", MsgBoxStyle.Critical, "提示")
txtpwd.Text = ""
txtuser.Focus()
End If
conn.Close()