Jump to content



Photo

Only Object-type variables allowed in a "With" statement.


  • Please log in to reply
10 replies to this topic

#1 oshaker

oshaker

    Seeker

  • Active Members
  • 34 posts

Posted 21 February 2010 - 06:46 AM

AutoIt         
#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?





#2 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 21 February 2010 - 08:04 AM

From memory that function returns an array. So For...Next will do the job. See what the function returns first though. Should be some documentation in MySQL.au3.

Cheers,

Brett

#3 oshaker

oshaker

    Seeker

  • Active Members
  • 34 posts

Posted 23 February 2010 - 10:23 AM

re-installing the ODBC MySQL driver solved the problem.

#4 Rambo

Rambo

    Seeker

  • Active Members
  • 43 posts

Posted 11 March 2010 - 11:50 PM

Hello. Im getting the same error with my script.

Well, the scripts works fine in my PC but im getting this error on another computer...
Regards

Attached Files



#5 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 12 March 2010 - 05:29 AM

Add some error checking in to see exactly where it fails :mellow:

#6 Rambo

Rambo

    Seeker

  • Active Members
  • 43 posts

Posted 12 March 2010 - 09:25 PM

I introduced the code from ptrex
http://www.autoitscript.com/forum/index.php?showtopic=111169&view=findpost&p=781749

And the result was this:

Posted Image

#7 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 13 March 2010 - 06:59 AM

I am unable to replicate but some observations. You called ObjCreate like 10 times in the one function. There was no need for it and I opened the object at the start of the script. Other than that there were no real problems I could see (or test).

Please grab the full version of SciTE and run it from there. Past the console output, so at least we know where the error is coming from.

Cheers,

Brett

#8 Rambo

Rambo

    Seeker

  • Active Members
  • 43 posts

Posted 15 March 2010 - 08:49 PM

error is get by $com. In code line "With $com"

#9 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 15 March 2010 - 10:28 PM

Which one? There are 4 different occurrences of it? What does that error mean in ENGLISH? Have you Googled the error and the error code?

Edited by BrettF, 15 March 2010 - 10:28 PM.


#10 Bowmore

Bowmore

    Feinschmecker

  • Active Members
  • PipPipPipPipPipPip
  • 781 posts

Posted 15 March 2010 - 11:00 PM

The error is that the "MSCommLib.MSComm" object is not being created.

If this is working on your PC but not on anther PC then I would suspect that the PC on which it is not working does not have "MSCommLib.MSComm" installed. I don't believe that MScomm is a standard component of windows. check if this file exists on the PC with the problem "C:\WINDOWS\system32\MSCOMM32.OCX".
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

#11 LoWang

LoWang

    Polymath

  • Active Members
  • PipPipPipPip
  • 205 posts

Posted 04 May 2010 - 02:21 PM

It happenes to me as well but on random computers in our company. Just now one computer was failing to connect on line
$Objconn.open in _MySQLConnect function
and that Comerror handler failed to catch it although it works in other cases! Is it because I compiled it with Autoit 3.3.0.0? Unfortunatelly I restarted the computer and then it works again without error! So I will have to wait when it happens next time :-\

Edited by LoWang, 04 May 2010 - 02:22 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users