Dim ConStr As String = ("provider=microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & "\mdb1.mdb;user id=admin;jet oledb:database password=cvxxcv1200")
Dim Conn As New OleDbConnection(ConStr)
Dim DataSet1 As New DataSet
Dim SQLstr As String = "SELECT * FROM Table1"
'--------------------------
If TextBox1.Text = "" Then
MsgBox("إدخل كلمة المرور", MsgBoxStyle.OkOnly, "الدخول")
Exit Sub
End If
DataSet1.Clear()
SQLstr = "SELECT * FROM Table1 WHERE password = '" & TextBox1.Text & "'"
Conn.Open()
Dim DataAdapter1 As New OleDbDataAdapter(SQLstr, Conn)
DataAdapter1.Fill(DataSet1, "Table1")
Conn.Close()
TextBox2.DataBindings.Clear()
TextBox2.DataBindings.Add("Text", DataSet1, "Table1.password")
If TextBox2.Text = TextBox1.Text Then
'كلمة المرور صحيحة
Else
MsgBox("خطأ في كلمة المرور", MsgBoxStyle.OkOnly, "الدخول")
TextBox1.Text = ""
TextBox1.Focus()
Exit Sub
End If