Jump to content

[Solved]_ERROR: Nested "With" statements are not allowed


Recommended Posts

I have this table structure & Im trying to return all Tags with same Hash

If you know any other UDF pls let me know. this is the UDF i took it from:

http://www.autoitscript.com/forum/index.ph...=20814&st=0

1) get hash ID

2) use hash ID to find out wich tag_IDS have same Hash ID

3) return all Tags with same hash ID

But i get error:

TEMP.au3 (64) : ==> Nested "With" statements are not allowed.:
With $Query2
^ ERROR

$Table = hash_table

==========================

ID_Hash = 1 Hash = Fish

$Table = Tag_table

==========================

ID_Tag = 1 Tag = blue

ID_Tag = 2 Tag = yellow

ID_Tag = 3 Tag = green

ID_Tag = 4 Tag = red

$Table = ids_hash_tag

==========================

ID_Hash = 1 ID_tag = 1

ID_Hash = 1 ID_tag = 2

ID_Hash = 1 ID_tag = 3

ID_Hash = 1 ID_tag = 4

$table  = 'ids_hash_tag'
;~ -
$fields = "ID_Tag"

$Query = _Query($sql,"SELECT * FROM "&$table&" WHERE ID_HAsh = '" &$hash_ID& "'") 
    With $Query
    While NOT .EOF
;~      $hash_ID = .Fields($fields).value
        
         _final_tag("1");===================< Function!  imagine we found ID already & it is 1
         
    .MoveNext
    WEnd
    EndWith
;~ -------------------------------------    
;~ Finally return TAGS
Func _final_tag($hash_ID_2)
    $table  = 'tag_table'
    ;~ -
    $fields = "Tag_Title"

    $Query2 = _Query($sql,"SELECT * FROM "&$table&" WHERE Tag_Title = '" &$hash_ID_2& "'") 

        With $Query2;=====================================< This is where it errors!

        While NOT .EOF
            $hash_ID_2 = .Fields($fields).value          
            ConsoleWrite($hash_ID_2 & @CRLF)
        .MoveNext
        WEnd
        EndWith 
EndFunc
Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

If nested With statements are not allowed then couldn't you just change the function to

Func _final_tag($hash_ID_2)
    $table  = 'tag_table'
   ;~ -
    $fields = "Tag_Title"

    $Query2 = _Query($sql,"SELECT * FROM "&$table&" WHERE Tag_Title = '" &$hash_ID_2& "'") 

       
        While NOT $Query2.EOF
            $hash_ID_2 = $Query2.Fields($fields).value  
           ConsoleWrite($hash_ID_2 & @CRLF)
        $Query2.MoveNext
        WEnd
       
EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

this is the first time I see this kind of code, no wonder i dont know what to do with it:

With $Query
    While NOT .EOF

But thanx your solution does work.

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...