Here's the code we have:

Set objConn = Server.CreateObject("ADODB.Connection")
objconn.Mode = adModeReadWrite
objConn.Open "dsn=myDSN"

...

vLastIndex = objConn.Execute("SELECT LAST_INSERT_ID()").Fields(0).Value

Here's what we got ....
Explorer just prompts:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Driver does not support this parameter



Any help ?

Regards,

Nelson





----- Original Message -----
From: "Luc Van der Veken" <[EMAIL PROTECTED]>
To: "Maurice Faeh" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, May 05, 2001 11:48 PM
Subject: Re: Some things stopped working with ADO / ODBC


> (Comments in-line)
> ----- Original Message -----
> From: "Maurice Faeh" <[EMAIL PROTECTED]>
> >
> > What you are saying is that in fact, the last_insert_id function returns
> the
> > id from the table where the LAST insert happened no matter what table we
> > read the value with the last_insert_id function out from?
> > In this case we will have to make sure, that we read the last_insert_id
> > right after any insert query (and assign it to variables for storage and
> > reuse), right?
>
>
> Right.
>
> > Since there's only one insert query in this routine, this shouldn't lead
> to
> > mixup of different last_insert_id()?This shouldn't cause a speed
problem,
> > would it? Since we are writing only 1 record, there shouldn't be a
chance
> > for million time returns?
>
> There will be.  The number of results doesn't depend on the number of
> records you inserted, but on the total number of records in the table
after
> the insert.
> For example, try this in the MySQL console with any existing tablename
> (sorry for any typo's, I usually try everything out but I don't have a
MySQL
> server at hand here - Murphy says that I will make an error here just
> because it's so simple).
>
> SELECT 1;
>
> You'll see the result 1 appear.
>
> SELECT 1 FROM tablename;
>
> You'll see as many ones as there are records in the table, because as soon
> as you include "from table", the query is executed for each record of that
> table, and returns whatever the result of what you asked it is for that
> record.  Now 1 is 1 for every record of every table, but SQL doesn't know
> that you're already aware of this and just does exactly what you tell it
to
> do ;-)
> I deliberately dropped the 'My' in MySQL here, because this goes for every
> SQL database, even for a .mdb file opened in Access or VB through DAO or
> ADO.
>
> > Or would you still just use:
> >
> > Set objRS = objConn.Execute ("SELECT LAST_INSERT_ID()")
>
> Or simply:
>
> variableLastIndex = objConn.Execute("SELECT
> LAST_INSERT_ID()").Fields(0).Value
>
> In VB6, things like "set objObject=Nothing" aren't required to free
> resources, so there's no harm in using objects this way.
>
> > Best Regards
> > Maurice
>
> Regards,
> Luc
>
>
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html"; before
> posting. To request this thread, e-mail [EMAIL PROTECTED]
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail [EMAIL PROTECTED] instead.
>



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to