Hello Juan,
Thanks for the quick response.
I have my code correct in my web config. In my one page, where this does
work, I'm calling up my key from the app settings as
Dim myconnection As New
SqlConnection(ConfigurationSettings.AppSettings("C onnString"))
This works great! It this other line of code that I have that I mentined
earlier,
Protected SQL_CONNECTION_STRING As String = _
'"Data Source=192.168.100.120,xxxx;Network Library=dbmssocn;Initial
Catalog=mycatalog;User ID=xxxx;Password=xxxx;"
that I can't seem to call it the same way. Is it because I'm calling it as a
string?
Rudy
"Juan T. Llibre" wrote:
Ty this in web.config:
<configuration>
<appSettings>
<add key="connstring" value="server=Data Source=192.168.100.120,xxxx;Network Library=dbmssocn;Initial Catalog=mycatalog;User ID=****;Password=*****;"/>
</appSettings>
</configuration>
Then, in your aspx file, call it like this :
Dim myConnection as New SqlConnection(ConfigurationSettings.AppSettings("c onnstring"))
Juan T. Llibre
ASP.NET MVP
===========
"Rudy" <Ru**@discussions.microsoft.com> wrote in message news:BD**********************************@microsof t.com... Hello All!
I'm just trying to set my SQL connection String in the app setting of my
Web Config. I got it to work on one page, but my code is a little diffrent
for another page that has a little more code and stuff goin on.
This is my current connection string..
Protected Const SQL_CONNECTION_STRING As String = _
"Data Source=192.168.100.120,xxxx;Network Library=dbmssocn;Initial
Catalog=mycatalog;User ID=****;Password=*****;"
This is the line of code that I would like to use
Dim myconnection As New
SqlConnection(ConfigurationSettings.AppSettings("C onnString"))
But when I use it, "SQL_Connection_String" is tagged as wrong in a line of
code further down, like...
Dim Sqlconnection1 As New SqlConnection(SQL_CONNECTION_STRING)
I get "Not declared" error.
I also tried it this way,
''' Protected Const SQL_CONNECTION_STRING As String = "MyConnection"
I'm think I'm just not putting it in the right way.
Any advice would be great!!
TIA!!!
Rudy