12-02-18, 05:38 PM
12-02-18, 06:01 PM
احذف dbpass &
12-02-18, 06:22 PM
12-02-18, 06:24 PM
اسم الجدول في الاستعلام خطأ
12-02-18, 06:56 PM
(12-02-18, 06:24 PM)طالب برمجة كتب : [ -> ]اسم الجدول في الاستعلام خطأ
اسم الجدول فى قاعدة البيانات App
اعمل ايه ؟
كتبت اسم الجدول صح ولكن فى خطاء تانى
[attachment=17138]
13-02-18, 01:47 AM
cmd.commandtext= ("iinsert Into app ([empname]),([empass]),([empnum]) values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')"
جرب هادا أخي ان شاء الله راح يزبط معك وازا ما زبط معك جرب هادا الكود
Try
Dim Savecommand As New OleDb.OleDbCommand
Dim newconnection As New OleDbConnection(Connectionstring)
Savecommand.Connection = newconnection
Savecommand.CommandType = CommandType.Text
Savecommand.CommandText = "insert into "
newconnection.Open()
Savecommand.ExecuteNonQuery()
newconnection.Close()
MsgBox("تمت عملية الاضافة والحفظ في قاعدة البيانات بنجاح", 64, "حفظ الاضافة")
Catch ex As Exception
MsgBox(ex.Message, 16, "خطأ")
End Try
جرب هادا أخي ان شاء الله راح يزبط معك وازا ما زبط معك جرب هادا الكود
Try
Dim Savecommand As New OleDb.OleDbCommand
Dim newconnection As New OleDbConnection(Connectionstring)
Savecommand.Connection = newconnection
Savecommand.CommandType = CommandType.Text
Savecommand.CommandText = "insert into "
newconnection.Open()
Savecommand.ExecuteNonQuery()
newconnection.Close()
MsgBox("تمت عملية الاضافة والحفظ في قاعدة البيانات بنجاح", 64, "حفظ الاضافة")
Catch ex As Exception
MsgBox(ex.Message, 16, "خطأ")
End Try
13-02-18, 01:54 AM
(13-02-18, 01:47 AM)spoony كتب : [ -> ]cmd.commandtext= ("iinsert Into app ([empname]),([empass]),([empnum]) values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')"تمام ياخى انا حليت المشكلة بس عايز كود مثلا لو السريال او الرقم الى مكتوبة فى ال textbox صح وموجودة فى قاعدة البيانات البرنامج يفتح مش موجودة يطلع رسالة خطاء
جرب هادا أخي ان شاء الله راح يزبط معك وازا ما زبط معك جرب هادا الكود
Try
Dim Savecommand As New OleDb.OleDbCommand
Dim newconnection As New OleDbConnection(Connectionstring)
Savecommand.Connection = newconnection
Savecommand.CommandType = CommandType.Text
Savecommand.CommandText = "insert into "
newconnection.Open()
Savecommand.ExecuteNonQuery()
newconnection.Close()
MsgBox("تمت عملية الاضافة والحفظ في قاعدة البيانات بنجاح", 64, "حفظ الاضافة")
Catch ex As Exception
MsgBox(ex.Message, 16, "خطأ")
End Try
13-02-18, 02:10 AM
تفضل اخي نفس المتغيرات وكل شي بس ما عليك الا تغيير ألآتصال والبيانات الداتا بيز طبعا هادا يوزر نيم والباسورد نفس الشي ازا بدك تكست واحد بس مو ثنين خلي واحد اكيد فهمت الطريقة حضرتك
Dim DbCon As New OleDb.OleDbConnectio
Dim dbUp As New OleDb.OleDbCommand
Dim Read As OleDb.OleDbDataReader
Private Sub Ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\User\Desktop\Database.mdb"
DbCon.Open()
dbUp.Connection = DbCon
dbUp.CommandType = CommandType.Text
dbUp.CommandText = "Select * from LOGIN where Username=yes and Password=no "
dbUp.Parameters.Add("Username", Data.OleDb.OleDbType.Variant)
dbUp.Parameters.Add("Password", Data.OleDb.OleDbType.Variant)
dbUp.Parameters("Username").Value = UsernameTextBox.Text
dbUp.Parameters("Password").Value = PasswordTextBox.Text
Read = dbUp.ExecuteReader
With Read
If .Read Then
Me.Hide()
Form2.Show()
Else
UsernameTextBox.Clear()
PasswordTextBox.Clear()
MessageBox.Show("Invalid Username or Password")
UsernameTextBox.Focus()
End If
End With
هاي كمان طريقة استخدمها في حالة الآولى ما فهمتها نفس الشي بس غير المضمون والحدث الي بدك اياه
Dim uname As String = ""
Dim pword As String
Dim username As String = ""
Dim pass As String
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("Plz Fill All the info")
Else
uname = TextBox1.Text
pword = TextBox2.Text
Dim querry As String = "Select password From Table1 where name= '" & uname & "';"
Dim dbsource As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\siddh\Documents\Database2.accdb"
Dim conn = New OleDbConnection(dbsource)
Dim cmd As New OleDbCommand(querry, conn)
conn.Open()
Try
pass = cmd.ExecuteScalar().ToString
Catch ex As Exception
MsgBox("Username does not exit")
End Try
If (pword = pass) Then
MsgBox("Login success")
Form2.Show()
If Form2.Visible Then
Me.Hide()
End If
Else
MsgBox("login Failed")
TextBox1.Clear()
TextBox2.Clear()
End If
End If
Dim DbCon As New OleDb.OleDbConnectio
Dim dbUp As New OleDb.OleDbCommand
Dim Read As OleDb.OleDbDataReader
Private Sub Ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\User\Desktop\Database.mdb"
DbCon.Open()
dbUp.Connection = DbCon
dbUp.CommandType = CommandType.Text
dbUp.CommandText = "Select * from LOGIN where Username=yes and Password=no "
dbUp.Parameters.Add("Username", Data.OleDb.OleDbType.Variant)
dbUp.Parameters.Add("Password", Data.OleDb.OleDbType.Variant)
dbUp.Parameters("Username").Value = UsernameTextBox.Text
dbUp.Parameters("Password").Value = PasswordTextBox.Text
Read = dbUp.ExecuteReader
With Read
If .Read Then
Me.Hide()
Form2.Show()
Else
UsernameTextBox.Clear()
PasswordTextBox.Clear()
MessageBox.Show("Invalid Username or Password")
UsernameTextBox.Focus()
End If
End With
هاي كمان طريقة استخدمها في حالة الآولى ما فهمتها نفس الشي بس غير المضمون والحدث الي بدك اياه
Dim uname As String = ""
Dim pword As String
Dim username As String = ""
Dim pass As String
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("Plz Fill All the info")
Else
uname = TextBox1.Text
pword = TextBox2.Text
Dim querry As String = "Select password From Table1 where name= '" & uname & "';"
Dim dbsource As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\siddh\Documents\Database2.accdb"
Dim conn = New OleDbConnection(dbsource)
Dim cmd As New OleDbCommand(querry, conn)
conn.Open()
Try
pass = cmd.ExecuteScalar().ToString
Catch ex As Exception
MsgBox("Username does not exit")
End Try
If (pword = pass) Then
MsgBox("Login success")
Form2.Show()
If Form2.Visible Then
Me.Hide()
End If
Else
MsgBox("login Failed")
TextBox1.Clear()
TextBox2.Clear()
End If
End If
13-02-18, 02:27 AM
(13-02-18, 02:10 AM)spoony كتب : [ -> ]تفضل اخي نفس المتغيرات وكل شي بس ما عليك الا تغيير ألآتصال والبيانات الداتا بيز طبعا هادا يوزر نيم والباسورد نفس الشي ازا بدك تكست واحد بس مو ثنين خلي واحد اكيد فهمت الطريقة حضرتك
Dim DbCon As New OleDb.OleDbConnectio
Dim dbUp As New OleDb.OleDbCommand
Dim Read As OleDb.OleDbDataReader
Private Sub Ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\User\Desktop\Database.mdb"
DbCon.Open()
dbUp.Connection = DbCon
dbUp.CommandType = CommandType.Text
dbUp.CommandText = "Select * from LOGIN where Username=yes and Password=no "
dbUp.Parameters.Add("Username", Data.OleDb.OleDbType.Variant)
dbUp.Parameters.Add("Password", Data.OleDb.OleDbType.Variant)
dbUp.Parameters("Username").Value = UsernameTextBox.Text
dbUp.Parameters("Password").Value = PasswordTextBox.Text
Read = dbUp.ExecuteReader
With Read
If .Read Then
Me.Hide()
Form2.Show()
Else
UsernameTextBox.Clear()
PasswordTextBox.Clear()
MessageBox.Show("Invalid Username or Password")
UsernameTextBox.Focus()
End If
End With
هاي كمان طريقة استخدمها في حالة الآولى ما فهمتها نفس الشي بس غير المضمون والحدث الي بدك اياه
Dim uname As String = ""
Dim pword As String
Dim username As String = ""
Dim pass As String
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("Plz Fill All the info")
Else
uname = TextBox1.Text
pword = TextBox2.Text
Dim querry As String = "Select password From Table1 where name= '" & uname & "';"
Dim dbsource As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\siddh\Documents\Database2.accdb"
Dim conn = New OleDbConnection(dbsource)
Dim cmd As New OleDbCommand(querry, conn)
conn.Open()
Try
pass = cmd.ExecuteScalar().ToString
Catch ex As Exception
MsgBox("Username does not exit")
End Try
If (pword = pass) Then
MsgBox("Login success")
Form2.Show()
If Form2.Visible Then
Me.Hide()
End If
Else
MsgBox("login Failed")
TextBox1.Clear()
TextBox2.Clear()
End If
End If
مش شغال حضرتك الجدول عندى اسمو log موجود فى id - serial بس السريالات بتبقى جوه القاعدة تمام هو بيطلب منى سريال تمام يكتبها فى التكست بوكس والبرنامج يشوف هل هى مطابقة والا بس