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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting To SQL Server in c#

Status
Not open for further replies.

ice78991

Programmer
Joined
Nov 20, 2006
Messages
216
Cannot connect to SQL Server 2005 database in c#

In configuration manager I check the properties for my Names Pipes - Pipe Name which is
\\.\pipe\MSSQL$CLASSIFIEDS\sql\query

In Enterprise Manager The database name is given as
SV-S6LT9IW9SV\CLASSIFIEDS

I am using the connection string as follows

SqlConnection myConnection = new SqlConnection("user id=sa;" +
"password=xxxxxx;server=\\\\SV-S6LT9IW9SV\\CLASSIFIEDS;" +
"Trusted_Connection=yes;" +
"database=master;" +
"Network Library = dbnmpntw;" +
"connection timeout=30");

I wish to connect over named pipes. This has all been enabled on the server. But when I run the application, it stalls and no connection is made.
 
First remote the username and password. When you are using a trusted connection you don't need to specify the username and password.

Second never use the sa account to connect an application to the SQL Server.

What's the exact error that you are getting?

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top