تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] سوال بحاجة الى جواب اصحاب الخبرة جزاكم الله خيرا
#1
السلام عليكم ورحمة الله وبركاته
اعمل على شاشة ادخال للمنتجات اواجه مشكلة وهي ان زيادة عدد المنتج لاتوجد بها اي مشكلة
اواجه مشكلة في ادخال السعر الجديد للمنتج سعر الشراء وسعر البيع وتاريخ النفاذ وارجو منكم الحل


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)

تفضل الاخ العزيز [b]Zuhare[/b] بالرد مشكورا

كود :
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"))

بعد التعديل كما موضح

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
    .Parameters.AddWithValue("@ProductBuyPrice", CInt(DataGridView1.Rows(i).Cells(8).Value.ToString))
    .Parameters.AddWithValue("@ProductSalePrice", CInt(DataGridView1.Rows(i).Cells(9).Value.ToString))
    .Parameters.AddWithValue("@ProductDate ", CDate(DataGridView1.Rows(i).Cells(10).Value.ToString))
    .ExecuteNonQuery()
End With

المشكلة اصبحت انه عندما اضيف مادة جديدة واحدث اعداد المخزن
يتم تعديل سعر الشراء وسعر البيع وتاريخ النفاذ للمادة المخزونة
المطلوب هي تحديث عدد المادة واضافة السعر الجديد والتاريخ للمادة الجديدة مع الحفاظ على المخزون مسبقا بسعرة وتاريخه
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
سوال بحاجة الى جواب اصحاب الخبرة جزاكم الله خيرا - بواسطة raedre22 - 07-07-24, 02:02 AM


التنقل السريع :


يقوم بقرائة الموضوع: