0 pts.
 Help me regarding datagrid control
I am facing problems while showing data from two different tables in DataGrid Control while entering new data. I have two Database Tables 1. VoucherDetail (VoucherID, ProductID, Quantity, Rate) 2. ProductMaster (ProductID, Name, Rate) Now the Problem is that I have made a sale voucher which contains a datagrid control (which is linked to VoucherDetail table) to add entries. Now I want to show ProductName from ProductMaster table in second column of datagrid control, as I enter ProductID in first column. And this is required while entering new data.

Software/Hardware used:
ASKED: March 30, 2006  5:10 PM
UPDATED: March 31, 2006  10:03 AM

Answer Wiki:
With any databound control, you can only have one datasource. In your case, where you want data from two sources, you need to combine them in some fashion. You could create a view on the database, for instance, and include all the fields from both tables. Or you could create a recordset which includes all the fields and bind your control to that. In either case, you need to design the SQL correctly to make it updatable. (I'm assuming whatever database you're using allows this.) Another alternative would be to have the ProductName field in a header field, outside the grid. But, I think your best option would be to A) use an updatable view and B) let the user pick the ProductName from a dropdown list, instead of forcing them to enter an ID.
Last Wiki Answer Submitted:  March 31, 2006  10:03 am  by  DaveInAZ   0 pts.
All Answer Wiki Contributors:  DaveInAZ   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _