jlcruzAME
Member
- Joined
- Oct 18, 2012
- Messages
- 21
- Programming Experience
- 1-3
I have quick question about this code as I am trying to call a stored procedure from VB.NET. Previously in my code I had tried to set up something like this:
For the Connection String I was using the same one that is set up in my web.config. I have the SQL Server installed on my laptop from which I was testing the site, and this would work. HOWEVER, when we moved it to the live server, where we were connecting to the SQL Server that was on another server, it would always error out saying it couldn't open a connection. Is it because my web.config already has this connection open and therefore trying to open it again would cause an error? Is there a way to use the connection without trying to open it again?
Any help would be appreciated.
VB.NET:
[COLOR=#003399][FONT=Verdana]Dim SQLCon As New SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString)
'SQL Select Statement Here
SQLCon.Open()[/FONT][/COLOR]
For the Connection String I was using the same one that is set up in my web.config. I have the SQL Server installed on my laptop from which I was testing the site, and this would work. HOWEVER, when we moved it to the live server, where we were connecting to the SQL Server that was on another server, it would always error out saying it couldn't open a connection. Is it because my web.config already has this connection open and therefore trying to open it again would cause an error? Is there a way to use the connection without trying to open it again?
Any help would be appreciated.