help with c# program

vanillathunder722

Active Member
Joined
Jan 14, 2011
Messages
66
Reaction score
0
Location
durban
Hi what i want to make is a program that will capture data and displays it.
Here's what's needed

1. database that contains 3 tables, club,client and belt(client will have a reference from club and belt with have both references from club and client)

so far ive made that database

2. the actual program, i've managed to make the app to enter all the above details but the problem now is how do i get the club id from the club table so that i can manually enter it in the belt table or the client table. I've set all the main primary keys to auto generate.

3. if i can fix the above problem then i'll be able to join the three tables and display all info with one datagridview.

if anyone knows how to solve the 2nd step please let me know.
any help will be great:)
 
What are you using to insert the the details into the club table and what database are you using?
There are ways of returning the identity value assigned when you do the insert but you need to give more details.
 
Dont allow people to manually enter IDs, ever. Use a combo box to allow them to select a club and client.
 
2. the actual program, i've managed to make the app to enter all the above details but the problem now is how do i get the club id from the club table so that i can manually enter it in the belt table or the client table. I've set all the main primary keys to auto generate.

Is it SQL?

If you have just inserted into the club table, you can get the ID by calling this function:
SELECT SCOPE_IDENTITY();
 
If you're using LINQ2SQL then when you insert your object into the db it will automatically populate the ID column in your object
 
Top
Sign up to the MyBroadband newsletter
X