473,396 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

connect to ms sql from C# code

Hi all,

I am trying to connect to a ms sql database from C# code. The code is being executed on the machine where the ms sql server is installed.

Am getting this error:

System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ReadSni Error(TdsParserStateObject stateObj, UInt32 error) at System.Data.SqlClient.TdsParserStateObject.ReadSni (DbAsyncResult asyncResult, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ReadPac ket(Int32 bytesExpected) at System.Data.SqlClient.TdsParserStateObject.Re...

The connection string is as followed:

connString = "initial catalog=rolesdb;data source=LOCALHOST\\OFFICESERVERS;Integrated Security=sspi";

SqlConnection conn = new SqlConnection(connString);

conn.Open();


Any idea how to fix this error.

Regards,
bernadet
Feb 23 '07 #1
2 10419
dorinbogdan
839 Expert 512MB
It seems that user/password information is missing from the connection string?
Feb 26 '07 #2
Motoma
3,237 Expert 2GB
Hi all,

I am trying to connect to a ms sql database from C# code. The code is being executed on the machine where the ms sql server is installed.

Am getting this error:

System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ReadSni Error(TdsParserStateObject stateObj, UInt32 error) at System.Data.SqlClient.TdsParserStateObject.ReadSni (DbAsyncResult asyncResult, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ReadPac ket(Int32 bytesExpected) at System.Data.SqlClient.TdsParserStateObject.Re...

The connection string is as followed:

connString = "initial catalog=rolesdb;data source=LOCALHOST\\OFFICESERVERS;Integrated Security=sspi";

SqlConnection conn = new SqlConnection(connString);

conn.Open();


Any idea how to fix this error.

Regards,
bernadet
MySQL provides a managed DLL to aid in connecting to a MySQL database using .NET.
Feb 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Kevin Sage | last post by:
For anyone who is having this problem and want to know the solution. Add this line of code before your connect method call. It loads up some config file that the code behind the scenes needs...
3
by: Bill | last post by:
When vb6 Winsock.RemoteHost is set to "127.0.0.1", c# socket listener cannot hear connect request (my old vb6 winsock listener could hear it...). Why doesn't this work, and is there a work...
6
by: Jerry Orr | last post by:
We are trying to determine the easiest (and cheapest) way to get connections for about 50 Win2K workstations on our LAN to DB2 on a z/OS server. We could install DB2 Connect Personal Edition on...
3
by: colin.anderson | last post by:
Hi I am trying to refresh table links at startup in an Access 2002 application. The following code is based on a number of articles posted in this group but this does not seem to work: ...
7
by: Michi Henning | last post by:
Hi, I'm using a non-blocking connect to connect to a server. Works fine -- the server gets and accepts the connection. However, once the connection is established, I cannot retrieve either the...
2
by: iwdu15 | last post by:
hey, i was wondering if 1) anyone could tell me whats wrong with my code, i did a little fixing to the msdn version fo this, or 2) how to make a simple program that will connect and listen for...
0
by: vicky | last post by:
Hello Experts, Trying to run sample Postgrel's ECPG(Embedded SQL)programs on RHL 9.0. Im unable to connect to PostgreSQL database (sirishadb) when I run the program .... # su postgres...
14
by: DaTurk | last post by:
I am makeing a Multicast server client setup and was wondering what the difference is between Socket.Connect, and Socket.Bind. It may be a stupid question, but I was just curious. Because I...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
2
by: daft | last post by:
Hi guys Following on from an issue a couple of years back, now archived: http://www.thescripts.com/forum/thread208561-tabledef.connect.html I'm having the same problems. I can update the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.