السلام عليكم ورحمة الله وبركاته
أشكر اخي سعود وأخي Ahmed_Online على الدعم المستمر للأعضاء
شاهد هذه الطريقة (تغنيك عن تحديد نوع الحقل في Parameter)
* ملاحظة هامة لمن يتعامل مع قواعد بيانات Access بواسطة Parameters يجب أن يكون ترتيب الحقول داخل جملة sql بنفس الترتيب للـ Parameters.
PHP كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sql As String = " Update Zatea " & _
" Set Customer = @Customer " & _
" , Area = @Area " & _
" , Bayan = @Bayan " & _
" , Phone1 = @Phone1 " & _
" , Phone2 = @Phone2 " & _
" , Mobile = @Mobile " & _
" , Fax = @Fax " & _
" , Email = @Email " & _
" , Notes = @Notes " & _
" Where zatea_id = @zatea_id "
Dim cmd As New OleDbCommand(sql, Conn)
cmd.Parameters.AddWithValue("@Customer ", txt_Customer.Text)
cmd.Parameters.AddWithValue("@Area ", Area_Combobox.Text)
cmd.Parameters.AddWithValue("@Bayan ", lbox_Bayan.SelectedItem)
cmd.Parameters.AddWithValue("@Phone1 ", txt_Phone1.Text)
cmd.Parameters.AddWithValue("@Phone2 ", txt_Phone2.Text)
cmd.Parameters.AddWithValue("@Mobile ", txt_Mobile.Text)
cmd.Parameters.AddWithValue("@Fax ", txt_fax.Text)
cmd.Parameters.AddWithValue("@Email ", txt_Email.Text)
cmd.Parameters.AddWithValue("@Notes ", txt_Note.Text)
cmd.Parameters.AddWithValue("@zatea_id ", Val(txt_Zatea_id.Text))
Try
Conn.Open()
cmd.ExecuteNonQuery()
Conn.Close()
MsgBox("تم التعديل بنجاح", MsgBoxStyle.Information, "")
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical, "")
End Try
End Sub
السلام عليكم ورحمة الله وبركاته
