06-07-24, 12:50 PM
(آخر تعديل لهذه المشاركة : 06-07-24, 01:06 PM {2} بواسطة raedre22.
تعديل السبب: تحديث
)
(06-07-24, 11:55 AM)Zuhare كتب : المشكله الاولى هل اضفت كود البارامتر يللي موجوده في التحديث وهي @ProductBuyPrice و @ProductSalePrice و @ProductDate ؟
كود :
cm = New SqlCommand("update tblProduct set ProductQuantity = ProductQuantity + " & CInt(DataGridView1.Rows(i).Cells(7).Value.ToString) & ", ProductBuyPrice=@ProductBuyPrice ,ProductSalePrice=@ProductSalePrice ,ProductDate=@ProductDate where ProductID like '" & DataGridView1.Rows(i).Cells(1).Value.ToString & "'", cn)
cm.Parameters.AddWithValue("@ProductBuyPrice",252.44)
cm.Parameters.AddWithValue("@ProductSalePrice",674.11)
cm.Parameters.AddWithValue("@ProductDate ",CDate("2024-07-07"))
المشكله التانيه احذف السطر On Error Resume Next لتعرف المشكله في الكود
شكرا جزيلا سوف اتابع الشرح وابلغك بالنتيجة لكن ارجو التوضيح لم افهم الارقام المضافة ؟
بعد اتباع الخطوات المشار اليها تم اتبدال الارقام الموجود بالشرح بحقول داتا جرد فيو لأضافة سعر الشراء وسعر البيع والاكسباير
المشكلة انه تم تغير اسعار المخزون السابق وتاريخ النفاذ
الكود بعد التعديل
cm = New SqlCommand("update tblProduct set ProductQuantity = ProductQuantity + " & CInt(DataGridView1.Rows(i).Cells(7).Value.ToString) & ", ProductBuyPrice=@ProductBuyPrice ,ProductSalePrice=@ProductSalePrice ,ProductDate=@ProductDate where ProductID like '" & DataGridView1.Rows(i).Cells(1).Value.ToString & "'", cn)
With cm
cm.Parameters.AddWithValue("@ProductBuyPrice", CInt(DataGridView1.Rows(i).Cells(8).Value.ToString))
cm.Parameters.AddWithValue("@ProductSalePrice", CInt(DataGridView1.Rows(i).Cells(9).Value.ToString))
cm.Parameters.AddWithValue("@ProductDate ", CDate(DataGridView1.Rows(i).Cells(10).Value.ToString))
cm.ExecuteNonQuery()
End With
