|
I am using DBCommand() for a select statement to MSSQL server. 1) If the record exists, I have to do Update on one of the fields in the record. 2)If the record does not exist, I have to Insert the entire record into the table.
DBCommand () Returns an Array to the return Value if the record exists otherwise returns an empty string if the record doesn't exist.
My Question: How do I check for the return Value in the script that calls DBCommand(). This is my command: $retCode = DBCommand($DSNConn, $sSQL)
I tried checking for $retCode[0,0], but the script errors out in case there is no record found. likewise, If i check for an empty string, the script errors out if the record exists.
I tried this check: IF (ubound($retCode, 1) = -1) where the value is -1 in case there are no records,
THis seemed to work. But i am not sure if this is a good condition to check for empty records.
Thanks, Pooja
|