I'm trying to create an SQL table to populate a kixforms ComboBox so I'm starting with getting the results from the table firs.

I've got the following script to get the results whitch is working but I also get the following error at the end of the script.

ERROR : Error in expression.!

Script

------------------------------

 Code:
$SQL_Server = "0.0.0.0"
$SQL_Database = "database"
$SQL_User = "sqluserid"
$SQL_Pass = "password"

Break On




$cnstring = "Driver={SQL Server};Server=$SQL_Server;database=$SQL_Database;uid=$SQL_User;pwd=$SQL_Pass" 
																			
$cn = CreateObject("adodb.connection") 
$cmd = CreateObject("adodb.command") 
$rs = CreateObject("adodb.recordset") 
																					
$cn.connectionstring = $cnstring
$cn.Open
																					
$cmd.activeconnection = $cn
$rs.cursortype = 1
$rs.locktype = 3
$rs.activecommand = $cmd
																					
$cmdtext = "Select * from lkp_Departments Order By Department "
			
$cmd.commandtext = $cmdtext
$rs.Open($cmd)

	Do While Not $rs.EOF
		? "Entry: " + $rs.fields.item("Department").value
	
		$rs.MoveNext
	Loop

$rs.Close($cmd)
	
? "done"

------------------------

I know the error is coming from the loop & $rs.movenext but without theses I only get the last result.


Edited by Allen (2015-10-06 09:32 PM)
Edit Reason: added code tags