1
Reply

how to use the connection string written in web.config file within .net application 2.0

17y
6.3k
0
Reply

    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.