christrinder
07-02-2004, 11:22 AM
Hi,
Previously all web apps I have done have been in asp.net (c#) using SQL server. now I'm doing a small app for myself in asp.net (c#) using a microsoft database. What I want to know is how you return the identity of a newly inserted record when you use a inline sql string. I've tried inserting the record then running a select for the top 1 record ordering my the primary key descending, but sometimes this seems to be running too quickly and hence dosn't return the correct ID. Is there another way to do this?
Thanks in advance for you help.
Chris
Previously all web apps I have done have been in asp.net (c#) using SQL server. now I'm doing a small app for myself in asp.net (c#) using a microsoft database. What I want to know is how you return the identity of a newly inserted record when you use a inline sql string. I've tried inserting the record then running a select for the top 1 record ordering my the primary key descending, but sometimes this seems to be running too quickly and hence dosn't return the correct ID. Is there another way to do this?
Thanks in advance for you help.
Chris