Thanks!
I've got it working with DBcommand() now after looking at your example code. I'll use that instead.

This works perfectly for me:

Code:

$dsn='DRIVER=SQL Server;SERVER=192.168.1.4;UID=user;PWD=pass;DATABASE=db'
$sql='SELECT id,mac,name FROM computers where locationid is NULL'
$recordset = DBCommand($dsn,$sql)
? 'Error = '+@ERROR+' - '+@SERROR

For $row=0 to Ubound($recordset,1)
For $column=0 to Ubound($recordset,2)
? 'Field(row='+$row+', column='+$column+') ='+$recordset[$row,$column]
Next
Next



What is the actual difference between DBcommand and DBgetrecordset?

I've been playing with DBgetrecordset too (for no particular reason) and i cant get that example code to work:

Code:

$objConn = DBConnOpen('DRIVER=SQL Server;SERVER=192.168.1.4;UID=user;PWD=pass;DATABASE=db')
$recordset = DBGetRecordset($objConn,"SELECT id,mac,name FROM computers where locationid is NULL")
$retcode = DBConnClose($objConn)
? "ubound($recordset,1)="Ubound($recordset,1) ;this is 2
? "ubound($recordset,2)="Ubound($recordset,2) ;this is -1 ?
For $row=0 to Ubound($recordset,1)
?"whole row is" $recordset[$row]
For $column=0 to Ubound($recordset,2)
? 'Field ='+$recordset[$row,$column]
Next
Next



I always get -1 for the second ubound. There are similar threads already about but they dont explain why.


Edited by Tomarse (2005-11-24 08:40 PM)