28-09-22, 02:31 PM
السلام عليكم ورحمة الله وبركاته عندما أقوم بحفظ بيانات تظهر مشكلة في DATATABLE للعلم كود صحيح نفس اسماء اعمده في قاعدة البيانات ونفس اسماء textbox
كود مرفق معا صوره توضح ماهو الخطأ
كود مرفق معا صوره توضح ماهو الخطأ
كود :
If labell.Text = "" Then
MessageBox.Show("الرجاء ادخال اسم المنتج")
Exit Sub
End If
If Qty.Text = "" Then
MessageBox.Show("الرجاء ادخال الكمية")
Exit Sub
End If
Dim DT As New DataTable
Dim da As New SqlDataAdapter("select *from PRODUCTS where label='" & labell.Text & "'", Module1.con)
da.Fill(DT)
If DT.Rows.Count > 0 Then
MessageBox.Show("اسم منتج موجود مسبقا ")
Else
Dim DR = DT.NewRow
DR!label = labell.Text
DR!label_product = label_product.Text
DR!date = DateTimePicker1.Value
DR!Qty = Val(Qty.Text)
DR!price = Val(Price.Text)
DT.Rows.Add(DR)
Dim cmdb As New SqlCommandBuilder(da)
da.Update(DT)
MessageBox.Show("تم الحفظ بنجاح", "الاضافة", MessageBoxButtons.OK, MessageBoxIcon.Information)
cl()
End If