Question Datagridview with ComboBoxColumn fetching data from joined table

Norman.M

New member
Joined
Dec 16, 2009
Messages
2
Programming Experience
Beginner
Hello everyone,

This is my first post as a newbie and i have done some search on this forums as well as read the rules before posting this.

I am using VB 2005 professional and SQL Server 2005 express edition.

For the last two weeks I have been trying to have a datagridview control on a form that will have datasource from a dataset with two tables that are related.
I want child the column to be a ComboBoxColumn where userts can select options and update the other data(from the other table).

I have two tables in an sql server 2005 database named computers:-
computers
locations

Table computers looks like this:(ID is the primary key column)
ID Location
Computer1 39
Computer2 40
Computer3 39
Computer4 41

Table locations looks like this:(LocationID is the primary key column)
LocationID Location
39 Computer room
40 Server room
41 Admin Office

I want the results on the DatagridView to look like this:
ID Location
Computer1 Computer room
Computer2 Server room
Computer3 Computer room
Computer4 Admin Office

With the location column being a ComboBoxColumn so that when a user enters a new ID say Computer5,they have a choice of a dropdownmenu for the Location column.
In the database table computers the item should be saved as well as the index value(to correspond to the LocationID).

How do I go about this?

Many thanks in advance
 
Last edited:
Back
Top