المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Bind combobox to two data sources



C# Programming
03-29-2012, 12:54 AM
I have a form with multiple textboxes displaying data from a bindingsource. The data comes from one table called Contacts. Within the Contacts data, there is a foreign key(CompanyId) to link the data to the Companies table. Each Contact belongs to one Company. Now when scrolling through the Contact data, I want a combobox to display the name of the company instead of the ID. I know I can create a join in my DataAdapter selectcommand, but then I get an error when I try to run the DataAdapter update. My ultimate goal is to have the company names displayed and when I choose to edit the contact, the company combobox will contain all available companies. This seems like it would be a pretty common practice, but I cannot find anything on how to pull this off. Can anyone point me in the right direction?