Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS SQL Connection Error

Status
Not open for further replies.

CodingIsFun

Programmer
Apr 9, 2004
134
US
I am a newbie to the .NET Environment. I developed a small web page to test connecting to an MS SQL 2000 database on a local machine.

The Stored Prodedure executed just fine. I moved this to a new web server to test data connections and received an error on the conn.Open() function. The error stated Server Does not Exist or No permissions. I can open the SQL Server up in Server Explorer using .NET 2003 on the new Web Server.

The following is my code. Any help would be greatly appreciated.


Private sproc As String, connString As String, conn As SqlConnection
Public CMD As SqlCommand

connString = "User ID = sa; Password = ;database = test; Server = BOX1\SQL1; Connect Timeout = 60"
conn = New SqlConnection(connString)
CMD = New SqlCommand
With CMD
.Connection = conn
.CommandType = CommandType.StoredProcedure
.CommandText = "test_proc"
End With
conn.open()

Thanks again..
 
This is the error.

SQL Server does not exist or access denied.
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()

Thanks again...
 
Hello,
I noticed that your connection string is different than what I have for vb.net and sql2000. I'm also new to vb.net.
Here's what my connection string looks like.
Hope this helps.

gblstrConnection = "Data Source=Local174"
gblstrConnection &= ";Initial Catalog=NorthWind"
gblstrConnection &= ";Integrated Security=False"
gblstrConnection &= ";User Id=" & struserid
gblstrConnection &= ";Password=" & strpassword


thanks,
Dianne001
 
I tried your connection string and received the same error.

This all worked when I used IIS on the same box as the SQL server.

When I moved it to my web server box I get this new error.

Apparently, Im not much of a network guy.

Thanks for your help
 
Well I figured it out. This may be a good reference for someone later on.

Apparently, there was 2 running instances of MS SQL Service on the data tier BOX1\SQL1 and BOX1. Which for some reason caused issues when making a connection to the server, I still dont see how when the connection string explicitly states BOX1\SQL1. I removed one of the instances, kicked the box and everything is working well.

Im more curious why this wasnt a problem when I used IIS on the same box as the data tier.

Thanks for you help dianne001..
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top