22-10-22, 02:43 PM
كود :
If e.KeyCode = Keys.Enter Then
cmd = New SqlCommand("Veryifqty", Module1.con)
cmd.CommandType = CommandType.StoredProcedure
da = New SqlDataAdapter(cmd)
da.Fill(dt)
If dt.Rows.Count < 1 Then
MessageBox.Show("كمية المدخلة لهدا المنتج غير متاحه")
For i As Integer = 0 To DGV_PRODUCT.Rows.Count - 1
If DGV_PRODUCT.Rows(i).Cells(0).Value = txtid.Text Then
MsgBox("هدا المنتج موجود مسبقا", MsgBoxStyle.Critical, "تحذير")
cl()
Exit Sub
End If
Next
Dim row As DataRow = dt.NewRow
row(0) = txtid.Text
row(1) = txtlabel.Text
row(2) = txtqty.Text
row(3) = txtprice.Text
row(4) = txtamount.Text
dt.Rows.Add(row)
Me.DGV_PRODUCT.DataSource = dt
cl()
tootal()
End If
End Ifلدي اجراء مخزن يتحقق من رقم المنتج والكمية تكون اكبر من كمية مدخله
يسمح بالبيع غير ذلك يظهر رساله تنبيه
هادي محاولة في تنفيد الكود ياريت الي يعرف يقول لي
كود :
create proc Veryifqty
@ID_product int , @qty_Entered int
as
select *from PRODUCTS
where ID_product=@ID_product and Qty>@qty_Entere