
January 4th, 2005, 07:33 PM
|
|
Contributing User
|
|
Join Date: Oct 2003
Location: Los Angeles, CA
Posts: 64
Time spent in forums: 2 h 51 m 7 sec
Reputation Power: 5
|
|
Access db @@indentity how to get new record
Hello folks,
I am using the following INSERT statement to add a new record in my table. I want to be able to get the Autonumber UserID field of the newly created record but I am getting the following error: "Characters found after end of SQL statement"
Code:
INSERT
INTO tblUser
(LoginName, UserPassword, EmailAddress, City)
Values
(@User, @UsrPassword, @EmailAddress, @City);
SELECT @@IDENTITY As 'Identity'
What is wrong in my statement?
How do I retrieve the Autonumber field of the newly created record?
How do I handle if the LoginName and/or EmailAddress already exists?
I want to be able save this INSERT statement as an Access Query and call it from my C# code.
I would appreciate any help.
Thanks
Mike
|