how to use the connection string written in web.config file within .net application 2.0
By in ASP.NET on Dec 21 2006
  • kamal kamal
    Dec, 2006 22

    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.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS