A
Alex
Hello!
I have a small prob, so pls help me to solve it.
I have 2 tables
Products(ProductID, ProductName, Price)
Stores(StoreID, StoreName)
now I must design a table for Income-Product: IncomeProducts(id, Date ,
ProductID, Quantity, Price, Total, StoreID).
But I want to display the table IncomeProducts in the DataGrid like that :
| ProductName | Price | Quantity | Total | StoreName
To do it: I use VIEW to make a visual Table (IncomeProductView):
SELECT dbo.IncomeProducts.[Date],
dbo.Products.ProductName,dbo.IncomeProducts.Price,
dbo.IncomeProducts.Quantity, dbo.IncomeProducts.Total,
dbo.Stores.StoreName
FROM dbo.IncomeProducts INNER JOIN
dbo.Products ON dbo.IncomeProducts.ProductID =
dbo.Products.ProductID INNER JOIN
dbo.Stores ON dbo.IncomeProducts.StoreID =
dbo.Stores.StoreID
And now I display this View on the DataGrid
....
SqlDataAdapter sda..
DataSet ds
sda.Fill(ds, "IncomeProductView");
DataGrid dg;
dg.DataSource = ds.Tables["IncomeProductView"];
.....
1. Want to ask you If I do correctly????
2. Now Everytime when i want to add a new 'row' to the table IncomeProducts,
I want it to be displayed in the DataGrid ( to do that, the View must
refresh to get the new inserted row). How can I do it???? or I must Clear
the ds and "Download" again??? It's very bad......
Thanks
I have a small prob, so pls help me to solve it.
I have 2 tables
Products(ProductID, ProductName, Price)
Stores(StoreID, StoreName)
now I must design a table for Income-Product: IncomeProducts(id, Date ,
ProductID, Quantity, Price, Total, StoreID).
But I want to display the table IncomeProducts in the DataGrid like that :
| ProductName | Price | Quantity | Total | StoreName
To do it: I use VIEW to make a visual Table (IncomeProductView):
SELECT dbo.IncomeProducts.[Date],
dbo.Products.ProductName,dbo.IncomeProducts.Price,
dbo.IncomeProducts.Quantity, dbo.IncomeProducts.Total,
dbo.Stores.StoreName
FROM dbo.IncomeProducts INNER JOIN
dbo.Products ON dbo.IncomeProducts.ProductID =
dbo.Products.ProductID INNER JOIN
dbo.Stores ON dbo.IncomeProducts.StoreID =
dbo.Stores.StoreID
And now I display this View on the DataGrid
....
SqlDataAdapter sda..
DataSet ds
sda.Fill(ds, "IncomeProductView");
DataGrid dg;
dg.DataSource = ds.Tables["IncomeProductView"];
.....
1. Want to ask you If I do correctly????
2. Now Everytime when i want to add a new 'row' to the table IncomeProducts,
I want it to be displayed in the DataGrid ( to do that, the View must
refresh to get the new inserted row). How can I do it???? or I must Clear
the ds and "Download" again??? It's very bad......
Thanks