[ciapug] Adodb -> mssql, grabbing from a result set

Lathrop Preston ciapug@cialug.org
Mon, 15 Dec 2003 12:34:30 -0600


Chris Hettinger wrote:

> Those that are familiar with ADODB...
> 	
> 	$sql = "SELECT LastGenID FROM QTII_UR.dbo.urlastgenid WHERE userid = 'encwebtools'";
>         	$rsCaseID = $qtdb->Execute($sql);
> 
> 
>>>Succeeds, Returns 1 record with the value '3281608'
> 
> 
>         	$caseID = $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 = $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 ???


Try accessing the value as $rsCaseID->Fields('LastGenID');

I have noticed that sometimes for no apparent reason Fields() will work 
but fields[] will not and the reverse.

you might also try doing the following

$tmp = $rsCaseID->GetAssoc();
var_dump($tmp);
to see if maybe there is a case sensitivity issue with mssql

Laith