freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Shaun Craig <s.craig AT andronics.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] SELECT @@IDENTITY AS InsertID
- Date: Thu, 06 Oct 2005 15:49:46 +0100
Hi all,
I've got an insert statement with SELECT @@IDENTITY AS InsertID at the end as I want to know what row the record was inserted into. I know the line I use works as i've tested it through tsql and its gives me back the correct row number. The problem is in my C code i cant get the value passed back to me, this is my code so far.
DBINT InsertID;
journey_id //global variable of type int
Query //which contains my insert statement and SELECT @@IDENTITY AS InsertID
dbfcmd(dbconn, Query)
dbsqlexec(dbconn)
dbresults(dbconn)
//Now i'm trying to bind the returned row number into InsertID
dbbind(dbconn, 1, INTBIND, (DBINT)0, (BYTE *)& InsertID);
if (dbnextrow(dbconn) != NO_MORE_ROWS)
{
journey_id = InsertID;
}
Unfortunately my program crashes either at the bind or dbnextrow() as i'm doing something wrong.
Any help would be appreciated as this is holding me back from other stuff, thanks.
Shaun.
-
[freetds] SELECT @@IDENTITY AS InsertID,
Shaun Craig, 10/06/2005
- <Possible follow-up(s)>
-
Re: [freetds] SELECT @@IDENTITY AS InsertID,
Thompson, Bill D (London), 10/06/2005
- Re: [freetds] SELECT @@IDENTITY AS InsertID, Shaun Craig, 10/06/2005
- Re: [freetds] SELECT @@IDENTITY AS InsertID, Thompson, Bill D (London), 10/06/2005
-
Re: [freetds] SELECT @@IDENTITY AS InsertID,
Lowden, James K, 10/06/2005
- Re: [freetds] SELECT @@IDENTITY AS InsertID, Shaun Craig, 10/12/2005
-
Re: [freetds] SELECT @@IDENTITY AS InsertID,
Thompson, Bill D (London), 10/12/2005
- Re: [freetds] SELECT @@IDENTITY AS InsertID, Shaun Craig, 10/12/2005
-
[freetds] SELECT @@IDENTITY AS InsertID,
Shaun Craig, 10/13/2005
- Re: [freetds] SELECT @@IDENTITY AS InsertID, Shaun Craig, 10/13/2005
Archive powered by MHonArc 2.6.24.