10-01-21, 12:44 PM
عندي مشكله في برمجه زر الحفظ
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Butadd.Click
Try
Dim insertinto As New SqlCommand("insert into table1( اسم العميل , رقم الجوال , نوع السيارة , ماركة السيارة , رقم الفاتورة , رقم الايصال , نوع الخدمة , التاريخ , المبلغ ) values (?,?,?,?,?,?,?,?,?) ", con)
insertinto.Parameters.AddWithValue("@ اسم العميل", OleDb.OleDbType.VarChar).Value = TextBox1.Text '
insertinto.Parameters.AddWithValue("@ رقم الجوال ", OleDb.OleDbType.VarChar).Value = TextBox2.Text
insertinto.Parameters.AddWithValue("@ نوع السيارة", OleDb.OleDbType.VarChar).Value = TextBox3.Text
insertinto.Parameters.AddWithValue("@ ماركة السيارة", OleDb.OleDbType.VarChar).Value = TextBox4.Text
insertinto.Parameters.AddWithValue("@ رقم الفاتورة", OleDb.OleDbType.VarChar).Value = TextBox5.Text
insertinto.Parameters.AddWithValue("@ رقم الايصال", OleDb.OleDbType.VarChar).Value = TextBox6.Text
insertinto.Parameters.AddWithValue("@ نوع الخدمة", OleDb.OleDbType.VarChar).Value = TextBox7.Text
insertinto.Parameters.AddWithValue("@ التاريخ", OleDb.OleDbType.VarChar).Value = TextBox8.Text
insertinto.Parameters.AddWithValue("@المبلغ ", OleDb.OleDbType.VarChar).Value = TextBox9.Text
insertinto.CommandType = insertinto.CommandText
insertinto.Connection = con
insertinto.ExecuteNonQuery()
Me.FillDataGridView("Select * From Table1")
Dim strinser As String = " insert ito table1(اسم العميل , رقم الجوال ,نوع السيارة , ماركة السيارة , رقم الفاتورة , رقم الايصال ,نوع الخدمة , التاريخ , المبلغ ) " _
& "VALUES(" & TextBox1.Text & " , ' " & TextBox2.Text & " , ' " & TextBox3.Text & " , ' " & TextBox4.Text & " , ' " & TextBox5.Text & " , ' " & TextBox6.Text & " , ' " & TextBox7.Text & " , ' " & TextBox8.Text & " , ' " & TextBox9.Text & " , ' )"
Dim cmd As New SqlCommand(strinser, con)
If con.State = ConnectionState.Closed Then con.Open()
con.Close()
MsgBox("تم الإضافة بنجاح", MsgBoxStyle.Information, "نجاح")
con.Open()
MsgBox("تم الحفظ", MsgBoxStyle.Information, "save")
Catch ex As Exception
MsgBox(ex.Message)
End Try
For Each k As Control In GroupBox1.Controls
If TypeOf k Is TextBox Then
k.Text = ""
End If
Next
End Sub
ومافيش ولا خطأ في القايمه و لما بعمل run وبعد كتابه البيانات بيظهر مربع الخطأ كده ( conversion from string " insertinto table1(type'" integre as not vaild )
ممكن حد يقولي الغلط فين
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Butadd.Click
Try
Dim insertinto As New SqlCommand("insert into table1( اسم العميل , رقم الجوال , نوع السيارة , ماركة السيارة , رقم الفاتورة , رقم الايصال , نوع الخدمة , التاريخ , المبلغ ) values (?,?,?,?,?,?,?,?,?) ", con)
insertinto.Parameters.AddWithValue("@ اسم العميل", OleDb.OleDbType.VarChar).Value = TextBox1.Text '
insertinto.Parameters.AddWithValue("@ رقم الجوال ", OleDb.OleDbType.VarChar).Value = TextBox2.Text
insertinto.Parameters.AddWithValue("@ نوع السيارة", OleDb.OleDbType.VarChar).Value = TextBox3.Text
insertinto.Parameters.AddWithValue("@ ماركة السيارة", OleDb.OleDbType.VarChar).Value = TextBox4.Text
insertinto.Parameters.AddWithValue("@ رقم الفاتورة", OleDb.OleDbType.VarChar).Value = TextBox5.Text
insertinto.Parameters.AddWithValue("@ رقم الايصال", OleDb.OleDbType.VarChar).Value = TextBox6.Text
insertinto.Parameters.AddWithValue("@ نوع الخدمة", OleDb.OleDbType.VarChar).Value = TextBox7.Text
insertinto.Parameters.AddWithValue("@ التاريخ", OleDb.OleDbType.VarChar).Value = TextBox8.Text
insertinto.Parameters.AddWithValue("@المبلغ ", OleDb.OleDbType.VarChar).Value = TextBox9.Text
insertinto.CommandType = insertinto.CommandText
insertinto.Connection = con
insertinto.ExecuteNonQuery()
Me.FillDataGridView("Select * From Table1")
Dim strinser As String = " insert ito table1(اسم العميل , رقم الجوال ,نوع السيارة , ماركة السيارة , رقم الفاتورة , رقم الايصال ,نوع الخدمة , التاريخ , المبلغ ) " _
& "VALUES(" & TextBox1.Text & " , ' " & TextBox2.Text & " , ' " & TextBox3.Text & " , ' " & TextBox4.Text & " , ' " & TextBox5.Text & " , ' " & TextBox6.Text & " , ' " & TextBox7.Text & " , ' " & TextBox8.Text & " , ' " & TextBox9.Text & " , ' )"
Dim cmd As New SqlCommand(strinser, con)
If con.State = ConnectionState.Closed Then con.Open()
con.Close()
MsgBox("تم الإضافة بنجاح", MsgBoxStyle.Information, "نجاح")
con.Open()
MsgBox("تم الحفظ", MsgBoxStyle.Information, "save")
Catch ex As Exception
MsgBox(ex.Message)
End Try
For Each k As Control In GroupBox1.Controls
If TypeOf k Is TextBox Then
k.Text = ""
End If
Next
End Sub
ومافيش ولا خطأ في القايمه و لما بعمل run وبعد كتابه البيانات بيظهر مربع الخطأ كده ( conversion from string " insertinto table1(type'" integre as not vaild )
ممكن حد يقولي الغلط فين