تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مشكلة في استخدام البارامترات ؟
#1
بسم الله الرحمن الرحيم
السلام عليكم ورحمة الله وبركاته

كتبت كود لتعديل بيانات سجل باستخدام البارامترات

[HTML]Dim cmd As New OleDbCommand("update Zatea set Customer=@txt_Customer,Area=@Area_Combobox, Bayan=@lbox_bayan, Phone1=@txt_Phone1, Phone2=@txt_Phone2, Mobile=@txt_mobile, Fax=@txt_Fax, Email=@txt_Email,Notes=@txt_Note where zatea_id=txt_Zatea_id.text", Conn)


cmd.Parameters.AddWithValue("@Customer", OleDbType.VarChar).Value = txt_Customer.Text

cmd.Parameters.AddWithValue("@Area", OleDbType.VarChar).Value = Area_Combobox.Text
cmd.Parameters.AddWithValue("@bayan", OleDbType.VarChar).Value = lbox_Bayan.SelectedItem

'cm.Parameters.AddWithValue("@age", OleDbType.Integer).Value = Val(age.Text)
'cm.Parameters.AddWithValue("@dob", OleDbType.Date).Value = dob.Text

cmd.Parameters.AddWithValue("@Phone1", OleDbType.VarChar).Value = txt_Phone2.Text
cmd.Parameters.AddWithValue("@Phone2", OleDbType.VarChar).Value = txt_Phone1.Text
cmd.Parameters.AddWithValue("@Mobile", OleDbType.VarChar).Value = txt_Mobile.Text
cmd.Parameters.AddWithValue("@Fax", OleDbType.VarChar).Value = txt_fax.Text

cmd.Parameters.AddWithValue("@Email", OleDbType.VarChar).Value = txt_Email.Text
cmd.Parameters.AddWithValue("@Notes", OleDbType.VarChar).Value = txt_Note.Text


DataConnection()

Try
cmd.ExecuteNonQuery()
MsgBox("تم التعديل بنجاح", MsgBoxStyle.Information, "")
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical, "")

End Try[/HTML]
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
مشكلة في استخدام البارامترات ؟ - بواسطة kafi - 09-07-13, 10:21 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم