Connection.Execute causes untrappable runtime error
From: Nicolas (johnyspeed_at_bicycle.com)
Date: 05/06/04
- Next message: Pascal Biston: "Re: SELECT MAX(...) returns 0"
- Previous message: Jan Hyde: "Re: SELECT MAX(...) returns 0"
- Messages sorted by: [ date ] [ thread ]
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!
- Next message: Pascal Biston: "Re: SELECT MAX(...) returns 0"
- Previous message: Jan Hyde: "Re: SELECT MAX(...) returns 0"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|