#include "mysql.au3" $objErr = ObjEvent("AutoIt.Error","MyErrFunc") Dim $var, $sql $sql = _MySQLConnect("UserName","Password","DB_Name","DB_IP_Address") $var = _Query($sql,"SELECT user.user_id, user.firstname,user.username,course.code FROM dokeos_main.user ,dokeos_main.course_rel_user, dokeos_main.course where user.user_id=course_rel_user.user_id and course_rel_user.course_code=course.code" ) FileOpen ( "c:\test.txt", 130) With $var While NOT .EOF FileWriteLine("c:\test.txt",.Fields("username").value & "," & .Fields("firstname").value & .Fields("code").value & @CRLF) .MoveNext WEnd EndWith _MySQLEnd($sql) Func MyErrFunc() $hexnum=hex($objErr.number,8) Msgbox(0,"","We intercepted a COM Error!!" & @CRLF & @CRLF & _ "err.description is: " & $objErr.description & @CRLF & _ "err.windescription is: " & $objErr.windescription & @CRLF & _ "err.lastdllerror is: " & $objErr.lastdllerror & @CRLF & _ "err.scriptline is: " & $objErr.scriptline & @CRLF & _ "err.number is: " & $hexnum & @CRLF & _ "err.source is: " & $objErr.source & @CRLF & _ "err.helpfile is: " & $objErr.helpfile & @CRLF & _ "err.helpcontext is: " & $objErr.helpcontext _ ) exit EndFunc
This gives me:
Only Object-type variables allowed in a "With" statement.
With $var
With ^ ERROR
How can I fix it?








