SqlConnection Object Keeping Reappearing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a web.config file containing the SQLConnection String to a SQL
Database. Before I implemented this SQLConnection String into web.config, I
had individual SQLConnection objects in each webform's designer tray. I am
now going back through the webforms and replacing the individual
SQLConnection Objects with a pointer to web.config ConnectionString.

However, whenever I delete the SQLConnection String objects from each
webform, they reappear the next time I open the webform. Why do these things
reappear? I'm making no references to them in the code-behind, so why do
they reappear?

Thanks.
 
You may be enlightened if you take a look at the "web designer generated
code" that is in the code-behind file. When you have connection objects
inserted in the designer the development environment will probably create the
connection string object to contain the connection string that has been
entered as a property to the connection object in the designer.

Take care to avoid modifications to the code that is generated until you are
familiar with what is going on.

Note that you can write the code yourself, without the designer, to
accomplish the same thing.
 
That explains it - Thanks!

Brad Roberts said:
You may be enlightened if you take a look at the "web designer generated
code" that is in the code-behind file. When you have connection objects
inserted in the designer the development environment will probably create the
connection string object to contain the connection string that has been
entered as a property to the connection object in the designer.

Take care to avoid modifications to the code that is generated until you are
familiar with what is going on.

Note that you can write the code yourself, without the designer, to
accomplish the same thing.
 

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

Back
Top