I am working on my senior project and I am using C#.net and Microsoft Access to create a program that lets the user store information into a database. I have many tables but the primary table that mostly everything connects to is the customers table. Well I know how to insert, update and delete using C#. But I need to know how to retrieve the primary key from the customers table which happens to be an autonumber. I kind of understand that I need to use SCOPE_IDENTITY or @@IDENTITY. I just have no idea how. I have tried a couple ways without any success.
precado999
0
Newbie Poster
Recommended Answers
Jump to PostDo your Insert Query, the do a SELECT @@IDENTITY Query immediately afterward. It's best to do both in a stored procedure with the Identity as an OUT parameter.
Try this link: http://www.netomatix.com/adonetauto.aspx
Jump to PostLet us know. Remember to mark the thread solved if this answered your question.
All 6 Replies
tgreer
189
Made Her Cry
Team Colleague
precado999
0
Newbie Poster
tgreer
189
Made Her Cry
Team Colleague
bcasp
13
Light Poster
imartinez
0
Newbie Poster
precado999
0
Newbie Poster
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.