G
Guest
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("ConnString"))
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
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("ConnString"))
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