VS 2003 how to do this on a datagrid.

adshocker

Well-known member
Joined
Jun 30, 2007
Messages
180
Programming Experience
Beginner
hi all,

here's my problem... i added some images to better explain my situation.

first i will show the table formats using the images below.

emp_dtl.jpg


dept_dtl.jpg


then, record(s) on each table.

emp_tbl.jpg


dept_tbl.jpg


now, this is what i want to do on my datagrid.
datagrid.jpg


can anyone help me on how can i do this?

thanks.
 
if i use an sql join as my SelectCommand, will it not affect my other commands like the UpdateCommand and InsertCommand?
 
yes... i still need it to do the insert, update and delete commands... is there another way to do this?

i was thinking that maybe i should add another column on my datagrid for the dept_no field and have some sort of unbound column that will contain the department name corresponding to that dept_no. where each time the deptno column validates, it will populate the unbound dept_name column. not sure if it's possible though.
 
Last edited:
yes... i still need it to do the insert, update and delete commands... is there another way to do this?

You can get the client to do a pseudo join..

The grid will have a COmboBox column whose DataSource is the lookup table, DisplayMember is the nice text, and ValueMember is the ID value. The combo's SelectedValue will be bound to the main table and the combo will be responsible for finding the ID and turning it into the nice text.

I have an example video of doing this on here, but it is for .NET 2/DataGridView. Search for "cjard_does_datagridviewcombo" and see if you get any hits. Note that some hits may be me telling others to perform the search also, as I give this advice out occasionally. If you cant find it, I will post the file again here. It wont be exactly the same but will give you the understanding to look up how to do that in 2003
 
ok thanks... let me check it out.
 
Back
Top