Connection.Execute causes untrappable runtime error

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Nicolas (johnyspeed_at_bicycle.com)
Date: 05/06/04


Date: Thu, 06 May 2004 02:44:51 -0700

Hello All,

This is not a question, but a description of a simple (solved) problem
and solution which others may be interested in.

I am writing a data processing app in VB6 using ADO. It does everything
basically using sql statements dynamically built from the user input.
Some queries are run using the recordset object's open method where
applicable, and the rest are run using the connection objects execute
statement.

This results in two possible typical syntax forms:
(1) rs.open sqlstring, cn
(2) cn.execute sqlstring

Then I added an extra step into my data processing and my app died on
the connection execute line. When I say died, I mean a proper runtime
error - untrappable. XP offered to report the problem to Microsoft -
and by now they must be sick of me!

I tried everthing I could think of to fix the problem. I copied the
code to other forms, no luck. I build a complete new app with just the
offending step, no luck. I reintalled mdac 2.8, no luck. Then I got
desperate (and since my machine needed a re-prep sometime), I sat down
to reinstalling my entire pc. I opened my app up an tried it again - no
luck.

Then logic (which has probably be screaming in your head already...)
kicked in, and I rebuilt the entire form which hosts the offending code
from scratch. That how I picked up my VERY SIMPLE error.

I had used the following syntax (the recordset open syntax): cn.execute
sqlstring, cn
where cn is a open connection object and sqlstring is a string variable
containing the sql statement.

The "cn" at the end of the statement is in the place where an optional
long variable could be used to get the records affected count from the
execute statement.

The problem, in my eyes anyway, is that it doesn't generate a normal
trappable runtime error, or a type mismatch, but a "let's report this to
MS" error - not very friendly or debuggable...

Cheers,
Nicolas
http://www20.brinkster.com/intefacesa/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: Denied software installation in GPO
    ... Good Luck ... Systems Administrator ... If I were you I would throw away that App, ...
    (microsoft.public.windows.server.active_directory)
  • Re: accidental deleting!!
    ... I've had quite a bit of luck with it. ... Rick Rogers, ... > This one here works quite well for basic file recovery: ... > However, in testing the app, I have found that it does not work. ...
    (microsoft.public.windowsxp.general)
  • Object class is invalid for this container
    ... I thought it was the _reportlistner class. ... still no luck. ... other class in this app has been used before in other apps. ... I think Paul P had this problem about "object class....", ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Good newsreader for OS X?
    ... Sean Holland wrote: ... > suppose that would be implied by it being an OS X app.) ... I've been having excellent luck with MT-NewsWatcher, ...
    (sci.lang.japan)