Hi,
I've a query which inserts several form fields and values to a DB - I've set
the ID of the records in Access to AutoNumber, and immediately after
inserting the data I want to find out what the ID is.
So usually, I query the DB using the form fields in the WHERE statements
(i.e. WHERE email
Does anyone have any thoughts on the best way of obtaining the ID
of a Autonumber field?
Will,
Check the archives, this comes up very regularly.
Eg:
http://www.mail-archive.com/cf-talk@houseoffusion.com/msg16432.html
Nick
this is something I have used in the past
cfquery datasource="u8ntcn0"
Insert into events(EventName)
Values('testing')
/cfquery
cfquery datasource="u8ntcn0" name="test"
select @@identity as ID_num
/cfquery
cfoutput query="test"
#ID_num#
/cfoutput
I've a query which inserts several form fields and values to
a DB - I've set
the ID of the records in Access to AutoNumber, and immediately after
inserting the data I want to find out what the ID is.
The other way is simply to use SELECT Max(ID) AS TheNewID FROM TableName
You need to wrap
- Original Message -
From: "Joseph Thompson" [EMAIL PROTECTED]
To: "CF-Talk" [EMAIL PROTECTED]
Sent: Wednesday, November 15, 2000 11:54 AM
Subject: Re: Autonumbers, inserts and queries
this is something I have used in the past
cfquery datasource="u8n
5 matches
Mail list logo