sattisanju
how to use the connection string written in web.config file within .net application 2.0
Posted by sattisanju in ASP.NET Programming on Dec 21, 2006
  • 0
  • 1
  • 5612
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.


Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS

PRIVACY POLICY | TERMS & CONDITIONS | SITEMAP | CONTACT US | ABOUT US | REPORT ABUSE
2014© C# Corner. All contents are copyright of their authors.