25-11-19, 12:07 AM
تفضل اخي الكريم :
PHP كود :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If MsgBox("هل انت متأكد من عملية حذف السجل : " & TextBox2.Text, MsgBoxStyle.YesNo + MsgBoxStyle.MsgBoxRight + MsgBoxStyle.MsgBoxRtlReading, "") = MsgBoxResult.Yes Then
Dim Na As String = TextBox2.Text
Dim cmd As New OleDbCommand(
"Delete From Table1 where [Name]='" & TextBox2.Text.Trim & "' and [Name] in (Select MyName From Table2 where MyName='" & TextBox2.Text.Trim & "' and Sum1=0 and Sum2=0) ", con)
If con.State = ConnectionState.Closed Then con.Open()
If (cmd.ExecuteNonQuery()) > 0 Then
cmd = New OleDbCommand("Delete From Table2 where MyName='" & Na & "' and Sum1=0 and Sum2=0", con)
cmd.ExecuteNonQuery()
MsgBox("تم الحذف", MsgBoxStyle.MsgBoxRight + MsgBoxStyle.MsgBoxRtlReading, "")
Else
MsgBox("لم يتم الحذف", MsgBoxStyle.MsgBoxRight + MsgBoxStyle.MsgBoxRtlReading, "")
End If
Form1_Load(Nothing, Nothing)
End If
End Sub
سبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر
