mybigoldbutts
New Member
I'm trying to get a sql connection string from the web.config file and have been failing miserably. My questions are, where exactly should I put this? I noticed that by default it has a <sessionState> tag that has a SQLConnectionString attribute within it. That all looks great but I still don't know how I can get the value that I would put to SQLConnectionString. Anybody have any ideas??<BR><BR>Thanks in advance.here's how you do it<BR><BR>'part of your web.config file will need to look like this <configuration><BR> <appSettings><BR> <add key="SQLConnection" value=http://aspmessageboard.com/archive/index.php/"server=myServer;uid=sa;pwd=;database=pubs"></add><BR> </appSettings><BR><BR>'in your code behind page add this line<BR>Imports System.Configuration.ConfigurationSettings<BR><BR>'and when you want to retrieve the value just do this<BR>AppSettings.Item("SQLConnection")<BR><BR>