Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bdp connects without asking

2 views
Skip to first unread message

john

unread,
Mar 5, 2007, 5:13:30 PM3/5/07
to
.Net v1.1, BDS 2006, Oracle

This is something I dont understand. If you create a bdpconnection in
designer, and a command, it will initiate database communications in the
InitializeComponent() call WITHOUT you even asking. By asking I mean calling
dataadapter Fill(), or command.Execute(). As soon as the connection is
assigned to the command in the generated code it tries to talk to the
database.

Database connections can fail and throw exceptions. So you can have
exceptions thrown from your form constructor that are unexpected. Unexpected
maybe is a bad word, let me say unwanted. Im not ready to talk to the
database yet! It may be offline, the network maybe down, etc..

Why is this? Do other ado.net providers have this behavior?


Robin

unread,
Mar 6, 2007, 12:50:15 AM3/6/07
to

Personally, I don't connect the BDPConnection in the IDE. I do it in
code when I want to use it. Normaly getting the connection properties
from Web.Config. Otherwise the DB always has to be in the same spot.

That said, I have real trouble with this, as if I *DO* open the
connection in the IDE, I have to remember to explicitly remove the
connection string before compiling.

--
Robin.

Australian Bridal Accessories := http://www.bridalbuzz.com.au
Turbo for Noobs (a work in progress) := http://turbofornoobs.blogspot.com/

Bob Swart

unread,
Mar 6, 2007, 1:38:07 AM3/6/07
to
Hi John,

> This is something I dont understand. If you create a bdpconnection in
> designer, and a command, it will initiate database communications in the
> InitializeComponent() call WITHOUT you even asking. By asking I mean calling
> dataadapter Fill(), or command.Execute(). As soon as the connection is
> assigned to the command in the generated code it tries to talk to the
> database.

Try to set Connection Pooling to False at design-time (and back to True
at runtime when you assign your final runtime Connection String).

Groetjes,
Bob Swart

--
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
Blog: http://www.drbob42.com/blog - RSS: http://drbob42.com/weblog.xml
New Delphi 2006 Courseware e-books at http://www.eBob42.com/courseware

john

unread,
Mar 6, 2007, 1:41:54 PM3/6/07
to

"Bob Swart" <b.s...@chello.nl> wrote in message
news:45ED0C4F...@chello.nl...

> Hi John,
>
>> This is something I dont understand. If you create a bdpconnection in
>> designer, and a command, it will initiate database communications in the
>> InitializeComponent() call WITHOUT you even asking. By asking I mean
>> calling dataadapter Fill(), or command.Execute(). As soon as the
>> connection is assigned to the command in the generated code it tries to
>> talk to the database.
>
> Try to set Connection Pooling to False at design-time (and back to True at
> runtime when you assign your final runtime Connection String).
>

Yes that did it. No exceptions from InitializeComponent(). Well I havent
tried then renabling pooling but its not necessary for this app.

thanks Bob Swart


john

unread,
Mar 16, 2007, 7:58:59 PM3/16/07
to
hmm something else I forgot to mention about this issue that is bad. You
can't simply trap the exception. It will have caused an early exit from your
InitializeComponent() method... which will probably leave your object pretty
well trashed.


0 new messages