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?
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/
> 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
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