[[Template core/front/global/updateWarning is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]
السلام عليكم ورحمة الله تعالى وبركاته عملت إجرا كي أحذف مورد بشرط ان لا يكون له فواتير باسمه في جدول الفواتير جدول الفواتير اسمه Achats الحقول هي : Numr, Société,Date, Montant جدول الموردين اسمه Fournisseurs الحقول هي : ID, Nom, Société
كود ألإجراء الذي عملته هو : Private Sub BtnSupprimer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSupprimer.Click
'Supprimer un enregistrement On Error Resume Next
If cnn.State = ConnectionState.Open Then cnn.Close() End If
Dim sql As String = "Select Fournisseurs From Achats" If Me.BindingContext(ds, "Fournisseurs").Count > 0 Then MsgBox("Vous Ne pouvez pas supprimer ce Fournisseurs!, car il y a des Achats a son Nom.", MsgBoxStyle.Exclamation) Exit Sub Else If MsgBox("Voulez vous vraiment Supprimer ce Fournisseurs ?", MsgBoxStyle.OkCancel) = MsgBoxResult.Cancel Then Exit Sub End If Dim r As Integer Dim stqlDel1 As String stqlDel1 = "Delete from Fournisseurs where ID =" & CInt(dgf.CurrentRow.Cells(0).Value) Dim cmdDel1 As New OleDbCommand(stqlDel1, cnn) cnn.Open()
r = cmdDel1.ExecuteNonQuery() cnn.Close() End If BtnActualiser_Click(Nothing, Nothing) End Sub
لكن سواء هذا المورد له فواتير في جدول الفواتير أم لا تطلع الرسالة المسج بوكس
تم النشر منذ
السلام عليكم ورحمة الله تعالى وبركاته
عملت إجرا كي أحذف مورد بشرط ان لا يكون له فواتير باسمه في جدول الفواتير
جدول الفواتير اسمه Achats الحقول هي : Numr, Société,Date, Montant
جدول الموردين اسمه Fournisseurs الحقول هي : ID, Nom, Société
كود ألإجراء الذي عملته هو :
Private Sub BtnSupprimer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSupprimer.Click
'Supprimer un enregistrement
On Error Resume Next
If cnn.State = ConnectionState.Open Then
cnn.Close()
End If
Dim sql As String = "Select Fournisseurs From Achats"
If Me.BindingContext(ds, "Fournisseurs").Count > 0 Then
MsgBox("Vous Ne pouvez pas supprimer ce Fournisseurs!, car il y a des Achats a son Nom.", MsgBoxStyle.Exclamation)
Exit Sub
Else
If MsgBox("Voulez vous vraiment Supprimer ce Fournisseurs ?", MsgBoxStyle.OkCancel) = MsgBoxResult.Cancel Then
Exit Sub
End If
Dim r As Integer
Dim stqlDel1 As String
stqlDel1 = "Delete from Fournisseurs where ID =" & CInt(dgf.CurrentRow.Cells(0).Value)
Dim cmdDel1 As New OleDbCommand(stqlDel1, cnn)
cnn.Open()
r = cmdDel1.ExecuteNonQuery()
cnn.Close()
End If
BtnActualiser_Click(Nothing, Nothing)
End Sub
لكن سواء هذا المورد له فواتير في جدول الفواتير أم لا تطلع الرسالة المسج بوكس
أرجوا التوضيح
وشكرا لكم يا أساتذة
شارك هذا الرد
رابط المشاركة
شارك الرد من خلال المواقع ادناه