Jump to content

Search the Community

Showing results for tags '_sql.ua3'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I've got a curious problem: (solved: see bottom of post) When I run SQL which calls a stored function, I get "This operation is not allowed when the object is closed" But when I copy that exact same SQL to the clipboard and run it on SQL server, I get a result without any problem. I can also change the SQL code to something much simpler, and the error vanishes. $sSQL = " declare @result int, @p11 varchar(255) " & @CRLF & _ " set @p11='No Error' " & @CRLF & _ " exec @result = uspWFInitializeChecklist @Company=" & $iCo & "," & _ "@Template='" & $v_template & "'," & _ "@SourceType='" & $sourcetype & "'," & _ "@Status=" & $status & "," & _ "@Name='" & $v_name & "'," & _ "@EnforceOrder='" & $enforceorder & "'," & _ "@UseEmail='" & $useemail & "'," & _ "@IsPrivate='" & $isprivate & "'," & _ "@AssignedTo='" & $v_username & "'," & _ "@Level=" & $v_level & "," & _ "@DueDate='" & $v_date & "'," & _ "@DueTime='" & $v_time & "'," & _ "@SendNotification='" & $sendnotification & "',@msg=@p11 output " & @CRLF & _ "select @result Result, @p11 Message" ;$sSQL = 'Select TOP 5 * from bJCCD with(nolock)' ; this works without a problem Local $iRows ;Number of rows Local $iColumns ;Number of columns Local $aResult SQL_Connect() ClipPut ( $sSQL ) ;if _SQL_GetTable2D(-1, $sSQL, $aResult, $iRows, $iColumns) = $SQL_ERROR Then if _SQL_QuerySingleRow(-1, $sSQL, $aResult) = $SQL_ERROR Then Msgbox(0 + 16 +262144,"Error","SQL Error: " & $SQLErr & _SQL_GetErrMsg() ) Else _ArrayDisplay($aResult) EndIf _SQL_Close() Does anyone have any idea why? The result when run on the server itself displays in one row with two columns. No errors. Things I've tried: Searching google (and these forums) Closing the connection at the end of the first query (in GetVPChecklists), then opening it again right before we attempt to run the more difficult stored procedure This error happens in _sql.au3 at line 467 when $objquery.eof is checked to see if there is any data. This is immediatly after _SQL_Execute was called which did not return an error. I've been scratching my head for a couple of days now, and would appriciate any pointers. Thanks! Edit: This code $sSQL = " declare @p11 varchar(255) set @p11='No Error' select @p11 " also pops up the same "operation not allowed" error. Edit: Solution!! Putting SET NOCOUNT ON at the beginning of my query solved the problem. Perhaps someone else will find this post while looking for a solution. My full query now looks like this: $sSQL = "SET NOCOUNT ON declare @result int, @p11 varchar(255) " & @CRLF & _ " set @p11='No Error' " & @CRLF & _ " exec @result = uspWFInitializeChecklist @Company=" & $iCo & "," & _ "@Template='" & $v_template & "'," & _ "@SourceType='" & $sourcetype & "'," & _ "@Status=" & $status & "," & _ "@Name='" & $v_name & "'," & _ "@EnforceOrder='" & $enforceorder & "'," & _ "@UseEmail='" & $useemail & "'," & _ "@IsPrivate='" & $isprivate & "'," & _ "@AssignedTo='" & $v_username & "'," & _ "@Level=" & $v_level & "," & _ "@DueDate='" & $v_date & "'," & _ "@DueTime='" & $v_time & "'," & _ "@SendNotification='" & $sendnotification & "',@msg=@p11 output " & @CRLF & _ "select @result Result, @p11 Message"
×
×
  • Create New...