Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP 2.0 DataSet.xsd - how to change connection string at runtime

Status
Not open for further replies.

joggi

Programmer
Nov 8, 2006
44
YU
Hi,
I've been trying to work with the XSDs and ran into a few problems.


1. How do you programatically change the connection string at runtime when using these TableAdapters via databinding in the IDE GUI?
2. I have in web.config connection string and I want my XSD to use this string to connect to database. Is it possible?

Thanks in advance
 
That is one of the major disadvantages of using strongly typed datasets. You cannot change them dynamically.
 
I found this solution. In my web.config I have this:

<connectionStrings>
<add name="MyConnString" connectionString="Persist Security Info=False;database=xxx;server=xxx;User ID=sa;Password=" providerName="System.Data.SqlClient"/>
</connectionStrings>

When I add dataset I choose this connection string from wizard.

From code I could say:

Private Shared constring As String

constring = ConfigurationManager.ConnectionStrings("MyConnString").ConnectionString
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top