sattisanju
how to use the connection string written in web.config file within .net application 2.0
Posted by sattisanju in .Net | ASP.NET on Dec 21, 2006
  • 0
  • 1
  • 5199
Do you know the answer for this question? Post it below.
Guest
Posted by kamal kamal on Dec 22, 2006
  • 0

You write connection string in the web.Config file. Like

<connectionStrings>

<add name="nwindCnn" connectionString="Data Source=Test\SQLEXPRESS;Initial Catalog=NWind;Integrated Security=True"/>

connectionStrings>

 In program you can use like this

Dim cnn As SqlConnection

cnn = New SqlConnection()

cnn.ConnectionString = ConfigurationManager.ConnectionStrings("nwindCnn").ConnectionString

 

You can write any number connection strings by giving proper names.


Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
PRIVACY POLICY | TERMS & CONDITIONS | SITEMAP | CONTACT US | ABOUT US | REPORT ABUSE
2013© C# Corner. All contents are copyright of their authors.