> Does anyone have an example of Inserting a record to a table in an Access
> database where one of the fields is an Autonumber field, and most

Just don't specify that field at all on the insert, just like MySQL (and 
any other database).  That part of it is the same across every SQL database 
I've ever seen.

It *IS* different what happens if you attempt to provide an ID -- Some dbs 
just won't do it, and others will allow it if your ID is in fact unqiue 
among the existing IDs.

I haven't tested using NULL for the ID on enough platforms to comment...

> importantly, retrieving the value of the newly inserted Autonumber field?
> I'm looking for the equivilant of mysql_insert_id() for ODBC. Thanks.

IIRC, it's "select @@INSERT from yourtablenamehere"

At least, in theory, that's supposed to work...

It *IS* how it works on SQL Server, except that they *BROKE* it under some 
settings in 7.0 (?) or something.  Caused me an infinite amount of trouble 
when my company moved a test site to a production server with *DIFFERENT* 
settings for the SQL Server setup.  Had to change all the places I did 
insert followed by @@INSERT into friggin' stored procedures.  Micorsoft 

Like music?  http://l-i-e.com/artists.htm

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to