Web.config File And Connection string

Aman Jen

Aman Jen

Jul 30 2013 1:33 AM
    Is it possible to connection string declared in web config file and use in subpages of Master Page once it defined  in master page....because I dont want to declare it again and again in sub pages because that again the same thing like declaring connection string locally like below on every subpage of Master Page

Public connStr As String = ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString
    Public cn As New SqlConnection(connStr)
    Public cmd As New SqlCommand

...plz help..

I Hope i am clear with my query

Answers (6)
Next Recommended Forum