Adding record in related fields

rHasan

Active member
Joined
Jan 10, 2007
Messages
43
Programming Experience
3-5
Hi,

I am very new in using sql server and database programming with ado.net. I can't feagure it out, how to add or update data in the relational fields.
I have three tables like this -

Group Table with GroupID, GroupName field
SubGroup Table with SGroupID, SGroupName field
Product Table with ProductID, ProductName, GroupID, SGroupID


There are relations between these tables. Group and SubGroup table has data in it. But question is, how to add or update records on the product table?


Actually I want to provide a form where fields will be ProductName, GroupName, and SGroupName. I want to use combobox for GroupName and SGroupName fields with will be filled with names from the respective tables, but i want to enter the ID field in the Product table.


How could this be achieved? I want to use stored procedure for this.

Should I have to load these three tables in the dataset, and make relation in the tables, and bind with the controls, or any easy way?


Can it be possible with something like -
VB.NET:
[/SIZE]
[SIZE=2]Select P.ProductID, P.ProductName, G.GroupName, SG.SGroupName[/SIZE]
[SIZE=2]From Product P, Group G, SubGroup SG[/SIZE]
[SIZE=2]Where P.ProductID = 1;[/SIZE]

[SIZE=2]
Sorry for the long post, but please help me with the concept. Thanks a lot in advance.


Regars
Kapalic
 
have you read the section of the DW2 link in my signature, titled "DIsplaying related data in your application"
 
Back
Top