Feb 3, 2003 #1 BiancaJ Technical User Nov 4, 2002 51 GB At the moment I have my database connection setings (i.e. Userid, password) in Global.asax. This is a drag as everytime I make a change to the connection string, I have to do a build. Can I have the connection string in the Web.Config file? Thanks, Bianca
At the moment I have my database connection setings (i.e. Userid, password) in Global.asax. This is a drag as everytime I make a change to the connection string, I have to do a build. Can I have the connection string in the Web.Config file? Thanks, Bianca
Feb 3, 2003 1 #2 vilrbn Programmer Oct 29, 2002 105 FR Yes, that's what I did: Update your config.web like this: <configuration> <appSettings> <add key="Conn" value="data source=ServerName;Initial Catalog=DBName;Integrated Security=SSPI"/> </appSettings> And to call it from elsewhere: Dim conSQL As SqlClient.SqlConnection Dim comSQL As New SqlClient.SqlCommand() conSQL = New SqlClient.SqlConnection() conSQL.ConnectionString = ConfigurationSettings.AppSettings("Conn" conSQL.Open() Hope it will help. Upvote 0 Downvote
Yes, that's what I did: Update your config.web like this: <configuration> <appSettings> <add key="Conn" value="data source=ServerName;Initial Catalog=DBName;Integrated Security=SSPI"/> </appSettings> And to call it from elsewhere: Dim conSQL As SqlClient.SqlConnection Dim comSQL As New SqlClient.SqlCommand() conSQL = New SqlClient.SqlConnection() conSQL.ConnectionString = ConfigurationSettings.AppSettings("Conn" conSQL.Open() Hope it will help.