Dynamic Sql Connection String

G

Guest

We are developing an asp.net web application. When we drag and drop the sql
connection object to the form we set the in the dynamic properties connection
string to use the connection string in the web.config file. Works Great
except everytime we need drag and drop a new data adapter on the form visual
studio automatically creates a new connection sql string object. Why? and how
to fix?
 
S

S. Justin Gengo

Mike,

You can't stop the built in Adpapter from doing that. But you could make
your own Adapter control that doesn't do that. Just create a new control and
inherit the Adapter control. Then find and override the method that calls
and creates the new SQL Connection object and do nothing or hook up your
connection automatically via code.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
S

S. Justin Gengo

Mike,

They can, but you have to set that in code. But you can't set it until it's
already on the page. Really the only way to get the default behaviour you
want is to create your own control. That's why it's great that .NET utilizes
inheritance, you can access all the prewritten behaviours of the control
with a single line of code:

Inherits System.Data.SqlClient.SqlDataAdapter

And then customize it to do what you want.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top