csharpnoob
Member
- Joined
- Dec 22, 2022
- Messages
- 11
- Programming Experience
- Beginner
hi so im trying to learn linq
what i wan to do is
when u add row it will add automatically second row with different data
something like that
the second row added manually
what im trying to do is when the first one added to database will add the second one
so should be like that
what i wan to do is
when u add row it will add automatically second row with different data
something like that
the second row added manually
what im trying to do is when the first one added to database will add the second one
so should be like that
SQL:
insert into Product_Units values( 9, 7 ,6, 30 , 180 )
--------------------------------- id, pid , qty, oneunitprice ,totalprice
insert into Product_Units values(9, 7, 1, 180 ,180)
------------------------------- id, pid, 1, totalprice.editvalue,totalprice.editvalue
C#:
////////////////////////
void getdata()
{
gridControl2.DataSource = priceunit.Products_Units.Where(x => x.Pro_ID == product.Pro_ID);
}
////////////////////////
void save()
{
var Data2 = gridView2.DataSource as BindingList<DAL.Products_Unit>;
foreach(var items in Data2)
{
items.Pro_ID = product.Pro_ID;
items.TotalSellPrice = Convert.ToDecimal(Txt_SalePRiceTax.Text);
}
priceunit.SubmitChanges();
}