![]() |
|
|
+ Search |
![]()
|
Jun 8th, 2002 20:09
Wes DeMoney, Sumegha,
While this can be done easily by using a stored procedure, I will tell
you how I do it using plain ol' ASP and whatever type of database
(Access, MySQL, SQL Server). Basically what you want to do is, use the
data that you just inserted as your WHERE clause, and SELECT your
identity field.
Sample:
"INSERT INTO Contacts (CName, CEmail, CPhone) VALUES ('" & strName
& "','" & strEmail & "','" & strPhone & "')"
Then:
"SELECT CID FROM Contacts WHERE (CName = '" & strName & "' AND CEmail
= '" & strEmail & "')"
Now, this may be more load heavy on your DB query than a stored
procedure, but it does the job when needed.
© 1999-2004 Synop Pty Ltd