31-07-21, 10:52 PM
السلام عليكم ربما لم اعرف ان اشرح
فانا سجلت في الداتا ahmed
و عندما اكتب AHMED يقبلها و كذلك يقبل ahmed ; يقبل Ahmed
فانا اريده الا يقبل الا ahmed كما هو مكتوب في الداتا
و كذل كلمة المرور يقبل الحروف الكبيرة و الصغيرة و لايبالي بما هو مكتوب
في الداتا
Imports System.Data.OleDb
Public Class Form1
Public con As New OleDbConnection("provider=microsoft.jet.oledb.4.0; data source = " & Application.StartupPath & "\Database.mdb")
Public da As OleDbDataAdapter
Public dt As DataTable
Dim SQLstr As String = "SELECT * FROM Login"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = Nothing And TextBox2.Text <> Nothing Then
MsgBox("يجب عليك إدخال إسم المستخدم", MsgBoxStyle.Information, "تنبيه")
TextBox1.Focus()
End If
If TextBox2.Text = Nothing And TextBox1.Text <> Nothing Then
MsgBox("يجب عليك إدخال كلمة المرور", MsgBoxStyle.Information, "تنبيه")
TextBox2.Focus()
End If
If TextBox1.Text = Nothing And TextBox2.Text = Nothing Then
MsgBox("يجب عليك إدخال إسم المستخدم و كلمة المرور", MsgBoxStyle.Information, "تنبيه")
TextBox1.Focus()
End If
If con.State = ConnectionState.Closed Then con.Open()
Using Cmd As New OleDbCommand(Nothing, con)
Cmd.CommandText = "SELECT COUNT(*) From Login Where Username = '" & TextBox1.Text & "' and Pass = '" & TextBox2.Text & "'"
Me.Label1.Text = Cmd.ExecuteScalar
Cmd.CommandText = "SELECT * From Login Where Username = '" & TextBox1.Text & "' and Pass = '" & TextBox2.Text & "'"
Home.Label1.Text = Cmd.ExecuteScalar
End Using
If Val(Me.Label1.Text) = 0 And TextBox2.Text <> Nothing And TextBox1.Text <> Nothing Then
MsgBox("اسم المستخدم أو كلمة المرور خطأ", MsgBoxStyle.Information, "تنبيه")
Me.BackColor = Color.Red
End If
If Val(Me.Label1.Text) > 0 Then
Home.Show()
Me.Close()
End If
End Sub
فانا سجلت في الداتا ahmed
و عندما اكتب AHMED يقبلها و كذلك يقبل ahmed ; يقبل Ahmed
فانا اريده الا يقبل الا ahmed كما هو مكتوب في الداتا
و كذل كلمة المرور يقبل الحروف الكبيرة و الصغيرة و لايبالي بما هو مكتوب
في الداتا
Imports System.Data.OleDb
Public Class Form1
Public con As New OleDbConnection("provider=microsoft.jet.oledb.4.0; data source = " & Application.StartupPath & "\Database.mdb")
Public da As OleDbDataAdapter
Public dt As DataTable
Dim SQLstr As String = "SELECT * FROM Login"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = Nothing And TextBox2.Text <> Nothing Then
MsgBox("يجب عليك إدخال إسم المستخدم", MsgBoxStyle.Information, "تنبيه")
TextBox1.Focus()
End If
If TextBox2.Text = Nothing And TextBox1.Text <> Nothing Then
MsgBox("يجب عليك إدخال كلمة المرور", MsgBoxStyle.Information, "تنبيه")
TextBox2.Focus()
End If
If TextBox1.Text = Nothing And TextBox2.Text = Nothing Then
MsgBox("يجب عليك إدخال إسم المستخدم و كلمة المرور", MsgBoxStyle.Information, "تنبيه")
TextBox1.Focus()
End If
If con.State = ConnectionState.Closed Then con.Open()
Using Cmd As New OleDbCommand(Nothing, con)
Cmd.CommandText = "SELECT COUNT(*) From Login Where Username = '" & TextBox1.Text & "' and Pass = '" & TextBox2.Text & "'"
Me.Label1.Text = Cmd.ExecuteScalar
Cmd.CommandText = "SELECT * From Login Where Username = '" & TextBox1.Text & "' and Pass = '" & TextBox2.Text & "'"
Home.Label1.Text = Cmd.ExecuteScalar
End Using
If Val(Me.Label1.Text) = 0 And TextBox2.Text <> Nothing And TextBox1.Text <> Nothing Then
MsgBox("اسم المستخدم أو كلمة المرور خطأ", MsgBoxStyle.Information, "تنبيه")
Me.BackColor = Color.Red
End If
If Val(Me.Label1.Text) > 0 Then
Home.Show()
Me.Close()
End If
End Sub
