WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: scotts on September 22, 2014, 10:48:28 AM

Title: error 506 invslid statement handle
Post by: scotts on September 22, 2014, 10:48:28 AM
Hi,

I am using code in a new wbt that I have used in the past in other apps. but for some reason I am getting 506 invalid statement handle when I run the new app.
I don't see anything wrong in the code and tried a different environment with still no luck. attached is the code in question.. any help or direction is appreciated.

BTW - version 2013C (looks like it is time to update, but I don't think that is the problem)
Title: Re: error 506 invslid statement handle
Post by: td on September 22, 2014, 11:04:04 AM
Which line of your script is generating the error?
Title: Re: error 506 invslid statement handle
Post by: scotts on September 22, 2014, 12:15:27 PM
line 92
Title: Re: error 506 invslid statement handle
Post by: td on September 22, 2014, 01:47:28 PM
Your script seems to be more or less boilerplate ODBC extender so I am hard pressed to provide any kind of satisfactory answer. The 'qFetch' function only generates the 506 error when its first parameter does not map to a valid handle in the extender's internal handle table.  But that doesn't make a lot of sense since if the handle is really bad, why doesn't the qExecDirect function catch the problem beforehand. Both functions use the same handle checking.

On the surface this would appear to only happen if there was some kind of memory corruption problem in the extender.  But given how the extender is written, it seems unlikely and why it would show up now is unclear. 

I guess the next question is what is different in the environment between now and when your script last worked successfully?
Title: Re: error 506 invslid statement handle
Post by: scotts on September 22, 2014, 02:11:46 PM
this is the oddest thing. I basicly cut and pasted into a new wbt file and now it works.. still doesn't work in the original.. huh... moving on, thanks for your help
Title: Re: error 506 invslid statement handle
Post by: td on September 22, 2014, 02:28:23 PM
Good you got it working but the mystery remains.