How do you insert your data into the database?
If you are sending a INSERT INTO statement, just add a "select Scope_Identity" at the end of your query and be sure you call your query reading the result back (into a datareader for example).
Your query string should look like this:
strSQL = "insert into tablename(fields list) values(values list) select Scope_Identity"
>Hello,
>I have a stored procedure that inserts a record into a table. What I would like to do is return the PK that is created for the records back to my application. I have done a little research already and it seems like Scope_Identity() is the function I want, but I can't figure out how to get that back to my app.
>
>Thanks,
>MAC
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com