14-09-19, 10:55 PM
(آخر تعديل لهذه المشاركة : 14-09-19, 11:00 PM {2} بواسطة عبد العزيز البسكري.)
السّلام عليكم و رحمة الله و بركاته
إضافة لما طرحه الأخ الغالي " ربيع " جزاه الله خير الجزاء
يجب إستبدال عبارة Ace إلى Jet
و الرقم 12 إلى 4
بجملة الإتّصال
تحياتي
كود :
Imports System.Data.OleDb
Public Class Form1
Public con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|Datadirectory|\Database.mdb")
Dim dt As New DataTable
Dim da As New OleDbDataAdapter
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = Nothing Then
MsgBox("UserName IS UN Courect", MsgBoxStyle.Information, "Info")
TextBox1.Focus()
Exit Sub
End If
If TextBox2.Text = Nothing Then
MsgBox("Password IS UN Courect", MsgBoxStyle.Information, "Info")
TextBox2.Focus()
Exit Sub
End If
dt.Clear()
da = New OleDbDataAdapter("select * from login where UserName= '" & TextBox1.Text & "' and Password = '" & TextBox2.Text & "'", con)
da.Fill(dt)
If dt.Rows.Count > 0 Then
Form2.Label1.Text = dt.Rows(0).Item("UserName")
Form2.Show()
Me.Close()
Else
MsgBox("UserName Or Password Is Un Courect")
End If
End Sub
End Classقناتنا على اليوتوب
