Re: Connection.Execute causes untrappable runtime error
From: Allcomp (fa097770_at_nospam.skynet.be)
Date: 06/08/04
- Next message: Allcomp: "Re: Debug stored procedures with VB6"
- Previous message: Schmidt: "Re: Problem with disconnected recordsets"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 8 Jun 2004 16:31:07 +0200
Hello,
Personally, when I don't want to use the dataenvironment, I open a recordet
so
Set Recordset = Database.Execute ("SQL Syntax")
The count = Recordset.RecordCount
If I want to do a delete or Update, I do a Database.Execute ("SQL Syntax")
I believe that the dataenvironment is the best thing in vb6 (The program are
simpler to understand as there is no SQL in vb6, only some calls to the
dataenvironment object
Marc Allard
Allcomp
"Nicolas" <johnyspeed@bicycle.com> a écrit dans le message de
news:uLvEI70MEHA.3208@TK2MSFTNGP10.phx.gbl...
> 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: Allcomp: "Re: Debug stored procedures with VB6"
- Previous message: Schmidt: "Re: Problem with disconnected recordsets"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|