Help me regarding datagrid control

0 pts.
Tags:
Development
Visual Basic
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.
ASKED: March 30, 2006  5:10 PM
UPDATED: March 31, 2006  10:03 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following