Sign in to follow this  
Followers 0
Queener

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

2 posts in this topic

#1 ·  Posted (edited)

Was working on the sql project and all of the sudden I kept getting:

Error: Only Object-type ariables allowed in a "With" Statement

The only with state that I use:

$query_name = "SELECT * from employers WHERE Full_Name like '%" & GUICtrlRead($searchinput) & "%'"
$exe_name = _Query($SQLOBJ, $query_name)
 
with $exe_name
    while NOT .EOF
If .Field('Full_Name').value <> $searchinput Then ;Check if $searchinput match Database record
GUICtrlSetData($IDLB, .Fields('UID').value) ;Set or display the result at $nameinput
GUICtrlSetData($nameinput, .Fields('Full_Name').value) ;Set or display the result at $nameinput
GUICtrlSetData($depinput, .Fields('Department').value) ;Set or display the result at $depinput
GUICtrlSetData($reportinput, .Fields('Manager').value) ;Set or display the result at $reportinput
GUICtrlSetData($DOHinput, .Fields('DateOfHire').value) ;Set or display the result at $DOHinput
GUICtrlSetData($Phoneinput, .Fields('Work_Phone').value) ;Set or display the result at $Phoneinput
GUICtrlSetData($Shiftinput, .Fields('Shift').value) ;Set or display the result at $Shiftinput
Return
EndIf
Return
WEnd
EndWith

Now I'm on 64-bit OS. I compiled to 86x and thats the error I have been getting. Compiling to 64x, it works fine again. I took the script and work on a 32bit OS and it's not taking the code. Is this normal or is mysql.au3 UDF build to work on 64bit os only?

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

Share this post


Link to post
Share on other sites



Bump to close this thread. I found a work around. Instead of using mysql.au3, I went with EzMySQL. Most of the codes are done through sql instead of using autoit commands to check for exists records etc....

For example:

Local $query1 = "SELECT * from employers WHERE Full_Name like '%" & GUICtrlRead($searchinput) & "%'"
 
If Not _EzMySQL_Query($query1) Then
ClearAll()
Else
;Execute the query
  For $i = 1 To _EzMySql_Rows() Step 1
   $a1Row = _EzMySql_FetchData()
   ;MsgBox (0, "Full_Name", $a1Row[1])
   ;_ArrayDisplay($a1Row, "Result: " & $i)
   ;Output it to textbox

GUICtrlSetData($nameinput, $a1Row[1]) ;Set or display the result at $nameinput
GUICtrlSetData($depinput, $a1Row[2]) ;Set or display the result at $nameinput
GUICtrlSetData($reportinput, $a1Row[3]) ;Set or display the result at $nameinput
GUICtrlSetData($DOHinput, $a1Row[4]) ;Set or display the result at $nameinput
GUICtrlSetData($Phoneinput, $a1Row[5]) ;Set or display the result at $nameinput
GUICtrlSetData($Shiftinput, $a1Row[6]) ;Set or display the result at $nameinput
GUICtrlSetData($IDLB, $a1Row[0]) ;Set or display the result at $nameinput
Next
Return
EndIf

 

or

if Not _EzMySQL_Query("Select Count(*) from employers where full_name like '%" & GUICtrlRead($nameinput) & "'") Then
 MsgBox(0, 'Query Error', 'Error: ' & @error & @CR & 'Error string: ' & _EzMySql_ErrMsg())
  Exit
 Else
  For $i = 1 To _EzMySql_Rows() Step 1
   $a1Row = _EzMySql_FetchData()
   ;MsgBox (0, "Counts", "Counts: " & $a1Row[0] + 0)
   ;_ArrayDisplay($a1Row, "Result: " & $i)
  Next
  EndIf

;Checks if record exist or not
If ($a1Row[0] + 0) = 0 Then
AddNewRecord()
Else
Update_Records()
EndIf

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0