28-02-18, 04:16 AM
(آخر تعديل لهذه المشاركة : 28-02-18, 04:35 AM {2} بواسطة طالب برمجة.)
PHP كود :
Private Sub TBsavecustm_Click(ByVal sender As Object, ByVal e As EventArgs) Handles TBsavecustm.Click
Dim command As New SqlCommand("insert into Customer(custname,custadress,custwork,custmob1,custmob2,custidno,custidwno,custother,custpic1,custpic2,custpic3) values(@custname,@custadress,@custwork,@custmob1,@custmob2,@custidno,@custidwno,@custother,@custpic1,@custpic2,@custpic3)", SQLcon)
Dim ms1 As New MemoryStream
If Not IsNothing(Piccustm1.Image) Then Piccustm1.Image.Save(ms1, Piccustm1.Image.RawFormat)
Dim ms2 As New MemoryStream
If Not IsNothing(Piccustm2.Image) Then Piccustm2.Image.Save(ms2, Piccustm2.Image.RawFormat)
Dim ms3 As New MemoryStream
If Not IsNothing(Piccustm3.Image) Then Piccustm3.Image.Save(ms3, Piccustm3.Image.RawFormat)
command.Parameters.AddWithValue("@custname", Texnamecustm.Text)
command.Parameters.AddWithValue("@custadress", Texadresscustm.Text)
command.Parameters.AddWithValue("@custwork", Texworkcustm.Text)
command.Parameters.AddWithValue("@custmob1", Texmob1custm.Text)
command.Parameters.AddWithValue("@custmob2", Texmob2custm.Text)
command.Parameters.AddWithValue("@custidno", Texidcustm.Text)
command.Parameters.AddWithValue("@custidwno", Texwidcustm.Text)
command.Parameters.AddWithValue("@custother", Texothercustm.Text)
command.Parameters.AddWithValue("@custpic1", ms1.ToArray)
command.Parameters.AddWithValue("@custpic2", ms2.ToArray)
command.Parameters.AddWithValue("@custpic3", ms3.ToArray)
' Dim DT As New DataTable
' If Not IsDBNull(DT.Rows(0).Item("@custpic1")) Then
' Dim ByteImg As Byte() = DirectCast(DT.Rows(0).Item("@custpic1"), Byte())
' End If
SQLcon.Open()
If command.ExecuteNonQuery() = 1 Then
MessageBox.Show("تمت اضافة المعلومات بنجاح..... شكرا")
Else
MessageBox.Show("لم يتم الاضافة ... لابد من جود خطاء او نقص معلومات")
End If
SQLcon.Close()
Load_Customer()
DGVSH.DataSource = dt_Customer
End Sub
Private Sub DGVSH_DataError(ByVal sender As Object, ByVal e As DataGridViewDataErrorEventArgs) Handles DGVSH.DataError
'اترك هذا الحدث كما هو فارغ ولا تحذفه
End Sub

