26-03-21, 05:51 PM
كود :
Imports System.Data.OleDb
Public Class Form1
Public con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database.mdb;Jet OLEDB:Datalap passward=;")
Dim dt As New DataTable
Dim da As New OleDbDataAdapter
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Close()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = Nothing Then
MsgBox("يجب عليك ادخال اسم المستخدم", MsgBoxStyle.Information, "تنبيه")
TextBox1.Focus()
Exit Sub
End If
If TextBox2.Text = Nothing Then
MsgBox("يجب عليك ادخال كلمة المرور ", MsgBoxStyle.Information, "تنبيه")
TextBox2.Focus()
Exit Sub
End If
dt.Clear()
da = New OleDbDataAdapter("select * from login where username = '" & TextBox1.Text & "' and passward = '" & TextBox2.Text & "'", con)
da.Fill(dt)
If dt.Rows.Count > 0 Then
home.Label1.Text = dt.Rows(0).Item("username")
home.Show()
Me.Close()
Else
MsgBox("اسم المستخدم او كلمة المرور غير صحيحة ", MsgBoxStyle.Information, "تنبيه")
End If
End Sub
End Class
اللهم اني قد نذرت نفسي لمساعدت الاخرين فوفقني وكن لي معين
جاهز لمساعدة اي حد يحتاج لمساعدتي
طبيب اعشق البرمجة .