06-01-18, 08:31 AM
ضعه هذا الكود مكان كود الحذف الي عندك
انا جربته شغال كويس
يارب يكون هو ده الى انت عاوزه
كود :
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Try
If DataGridView1.RowCount <= 0 Then
Exit Sub
End If
Dim I As Integer = DataGridView1.CurrentCell.RowIndex
con.Open()
cmd = New OleDbCommand("DELETE FROM tb1 where ID_mail like " & DataGridView1.Rows(I).Cells(0).Value & " and clien_mail like '" & DataGridView1.Rows(I).Cells(1).Value.ToString & "'", con)
cmd.ExecuteNonQuery()
con.Close()
DataGridView1.Rows.RemoveAt(DataGridView1.CurrentRow.Index)
MsgBox("تمت عملية الحذف في قاعدة البيانات بنجاح", 64 + 524288, "حذف سجل من كلا الجدولين")
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Subيارب يكون هو ده الى انت عاوزه
صلى الله على نبينا محمد
اخيكم / محمود صالح
قال الزهري رحمه الله
مــا عُـــبـِد الله بشئ أفضل من العلم

