[ciapug] Adodb -> mssql, grabbing from a result set
Chris Hettinger
ciapug@cialug.org
Mon, 15 Dec 2003 12:15:00 -0600
My script does a insert into a MsSQL table, the insert is done in mssql =
with a trigger that grabs a generated id, does the insert then writes =
the id it used to the 'urlastgenid' table, tagged by my userid =
'encwebtools'. The next statement in my script the query for the =
lastgenid (below).
The odd thing is that in my script if I comment out the execution of the =
insert, and run the script it grabs the value in that lastgenid field =
just fine. However when following the insert it fails, The SQL returns =
False. I even considered the possibility of latency, allowing SQL the =
time complete its processing... so I used a sleep(5) (5 second pause) =
... still failed.
---------- Here the segment of the script ------------------
...
$sql =3D "INSERT INTO QTII_UR.dbo.case_ =
(patientid,calldate,callername,callerphon,follow,callertype) VALUES ( =
'5986075', '2003-12-15 09:38:50', 'Hettinger, Chris', '5152055711', =
'5152055711', '2')";
$result =3D $qtdb->Execute($sql);
if($result =3D=3D=3D false) die('Failed');
$sql =3D "SELECT LastGenID FROM QTII_UR.dbo.urlastgenid WHERE userid =3D =
'encwebtools'";
$rsCaseID =3D $qtdb->Execute($sql);
if($rsCaseID =3D=3D=3D false) die('CaseID lookup Failed');
$caseID =3D $rsCaseID->fields['LastGenID'];
...
-----------------------------------------------
-----Original Message-----
From: Chris Hettinger=20
Sent: Monday, December 15, 2003 10:15 AM
To: Ciapug (E-mail)
Subject: [ciapug] Adodb -> mssql, grabbing from a result set
Those that are familiar with ADODB...
=09
$sql =3D "SELECT LastGenID FROM QTII_UR.dbo.urlastgenid WHERE userid =
=3D 'encwebtools'";
$rsCaseID =3D $qtdb->Execute($sql);
>> Succeeds, Returns 1 record with the value '3281608'
$caseID =3D $rsCaseID->fields['LastGenID'];
$caseID is empty... Though my select is succeeding the assignment is not =
grabbing the value of the field. I have also tried the assignement like =
this:
$caseID =3D $rsCaseID->fields[0]; // still nothing.
I have review the Adodb manual, but not sure if I need to do this =
assignment differnet since I am querying a Mssql DB ???
-Chris Hettinger, Web Specialist
-IFMC/ENCOMPASS
-www.encompas.com
-(515) 279-8730
CONFIDENTIALITY NOTICE: This communication, including any attachment, =
may contain confidential information and is intended only for the =
individual or entity to whom it is addressed. Any review, =
dissemination, or copying of this communication by anyone other than the =
intended recipient is strictly prohibited. If you are not the intended =
recipient, please contact the sender by reply email, delete and destroy =
all copies of the original message.'
_______________________________________________
ciapug mailing list
ciapug@cialug.org
http://cialug.org/mailman/listinfo/ciapug
CONFIDENTIALITY NOTICE: This communication, including any attachment, =
may contain confidential information and is intended only for the =
individual or entity to whom it is addressed. Any review, =
dissemination, or copying of this communication by anyone other than the =
intended recipient is strictly prohibited. If you are not the intended =
recipient, please contact the sender by reply email, delete and destroy =
all copies of the original message.'