I'm pretty new to C# programming and .NET programming however I have a great deal of experience with database & programming in the world of Unix,PHP,Perl, Javascript. I've been learning C# database programming with a WROX book but it doesn't tell you everything and unfortunately I need a little hand holding right now.

Well I'm working on my training application as I call it. It has two tables CLIENT and EMPLOYEE with client having a foreign key to employee. The key lets you know which employee helped which client last.

I have a Form that lays out the CLIENT information in List view and I want the "lasted helped by" field to be a combo box displaying the last employee who helped the client with the option to change the value via the combo box. I'm able to bind the box to the data source for the available EMPLOYEES but it doesn't seem to work in terms of showing the foreign key value. I know I'm missing something or doing something wrong but don't know where to look for more information on the subject. Could someone make a suggestion?

I suspect that binding may not be an option since I want the combo to drop down to <lastname, firstname> values while updating in the background to a numeric key value.

Just a guess but it sounds like you may have built a data source which only represents the clients table, you can manually create a sql statement to join the clients table to the employees table on the foreign key employee id, then i think your binding should work. Although typed datasets are good for some situations they are mostly a good quick and dirty fix for non complex tables, if you want real flexibility I would suggest building your owwn objects/data layer and writing stored procedures to get the data in the format you'd like

Hi sedguy,

Good to hear your guess especially since its what I've thought of in the last 24 hours. I've basically been reading another C# 2005 development book I picked up trying to figure out where I need to stop dragging, dropping and configuring and start programming my own procedures. The input is very much appreciated. Thanks

-Jerry

Not a problem, let me know if you have any other questions, I sometimes use this to speed up the object generation process:

http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp

it's cool if you already have an existing database as it builds objects for each of the tables and procedures to add/delete/update them. It works using generics (new for C# 2.0) although beware, as it doesnt handle primary key identities very well (when it creates the add procedures and objects it allows the primary key to be writable) although it's easily tweaked.

I'd suggest doing ot the hard way first though as then you'll find it easy to modify the generated code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.