Hello guys,
I'm using the DBGetRecordSet UDF to get some Mysql query results. I have the following code:
 Code:
 Dim $cnstring, $recordset, $retcode, $Workstation, $MAC, $DOMAIN, $row, $column, $COUNT, $MachineString, $LabMachine, $Query
Dim $ArrayItem
$cnstring = DBConnOpen('Driver={MySQL ODBC 3.51 Driver};Server=kbox;Database=ORG1;User=R1;Password=******;Option=3;')
$Query = "Select NAME, MAC, DOMAIN FROM MACHINE WHERE NAME LIKE '" + $Prefix + "%' ORDER BY NAME LIMIT 1000;)" 

$recordset = DBGetRecordset($cnstring,$Query)
$retcode = DBConnClose($cnstring)
Dim $LabMachines[999]
?? UBound($recordset) ??
For $row = 0 to UBound($recordset,1)
		$Workstation = $recordset[$row,0]
		$MAC = $recordset[$row,1]
		$Domain = $recordset[$row,2]
		$MachineString = $Workstation + "," + $MAC + "," + $Domain
	$LabMachines[$row] = $MachineString
Next
ReDim Preserve $LabMachines[$row - 1]
$CV_GetReservationInfo = $LabMachines
EndFunction


This code works a treat. However, whenever I add one additional criteria to the query, the function fails and returns -1.
An example of a similar query which is not working is:
 Code:
Select NAME, MAC, DOMAIN FROM MACHINE WHERE NAME LIKE '" + $Prefix + "%' AND NAME NOT LIKE '%Teach%' ORDER BY NAME LIMIT 1000;)" 
 


Using that same exact query in MySql workbench, i get the desired results. However, running it through the DBGetRecordSet function, doesn't seem to work correctly.
I was hoping someone could shed some light as to what may be going on. I could technically manipulate the string contents from the "unfiltered" query results, but that's a very cloodgy way of doing it, and I'd rather have the query itself return the desired results.

Any help would be greatly appreciated !!

quick side question:
A little while I go, I stumbled on a post which had a really neat trick to shorten the
 Code:
If InStr($string,abc) AND InStr($string,def) AND InStr($string,ghi) , etc.

into something with the split() function with delimiters, kind of like this:
 Code:
$StringsToSearch="abc~def~ghi"
If InStr($string,split($StringsToSearch,"~") = 1 


(I know that this is wrong code, but I'm trying to find that thread where that was explained... can someone link me that if possible?

Thanks!
_________________________
Network Specialist
Chino Unified School District