stop dbconnection in InitializeComponent()

J

jarb

Is there any way to change the order code is generated in InitializeComponent()?
Or to keep designer generated ADO.NET code from trying to connect?

If im dropping data adapters, connections, etc.. in the designer, as soon as the
connection string is set any following code that references the connection
object initiates the connection. I dont want any connection happening until I
ask for it with a Fill() call. I dont want to have to wrap all my constructors
with database exception handlers. Surely there is a way of having some control
over this?

thanks
 
J

jarb

jarb said:
Is there any way to change the order code is generated in
InitializeComponent()? Or to keep designer generated ADO.NET code from
trying to connect?

If im dropping data adapters, connections, etc.. in the designer, as
soon as the connection string is set any following code that references
the connection object initiates the connection. I dont want any
connection happening until I ask for it with a Fill() call. I dont want
to have to wrap all my constructors with database exception handlers.
Surely there is a way of having some control over this?

thanks

No response on this one. I guess the only way to stop the connection attempts is
to manually edit the designer generated code. Make the connection string = line
be the last line in the function. Unfortunately you have to do this after every
time you open the component in designer because it moves the code around again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top