stop dbconnection in InitializeComponent()

  • Thread starter Thread starter jarb
  • Start date Start date
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
 
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.
 
Back
Top