locked
Error openning a connection RRS feed

  • Question

  • User-14642827 posted

    Here is the error: A connection was successfully established with the server, but then an error occurred during the login process, error 0, No process is on the other end of the pipe. What cause this error and how do I fix it?

    SQL Server 2016

    Visual Studio 2017

    Here is my connection string:

    string connectionString = @"Data Source=BRENTHUMBER\BRENT;Initial Catalog=BrentPractice;Integrated Security=False";
                SqlConnection conn = new SqlConnection(connectionString);
                SqlCommand cmd = new SqlCommand();
                try
                {
                    string strCommand = "Insert INTO Tracker(id, edi, personsName, date, descriptor, details, reasons, notes)";
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = strCommand;
                    cmd.Connection = conn;
                    conn.Open(); // <-----------------------------------------error here

    Sunday, January 21, 2018 1:58 AM

All replies

  • User533502567 posted

    string connectionString = @"Data Source=BRENTHUMBER\BRENT;Initial Catalog=BrentPractice;Integrated Security=False";

    You have to specify DB user Id & pwd in connection string.

    Sunday, January 21, 2018 6:12 AM
  • User1120430333 posted

    Integrated Security=False"

    If false, then you have to put user-id and password in connectionstring to logon to the SQL Server database.

    Sunday, January 21, 2018 1:31 PM
  • User1400794712 posted

    Hi bthJ6,

    Just like what budugu and DA924 said, when we set Integrated Security=False:

    Comes from msdn document:

    When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication.

    Recognized values are true, false, yes, no, and sspi (strongly recommended), which is equivalent to true.

    So, in the connection String, you should add user id and password(which can login this database) in it.

    The connect string should be:

    string connectionString = @"Data Source=BRENTHUMBER\BRENT;Initial Catalog=BrentPractice;Integrated Security=False;User Id==XXXX;Password=XXX";

    Best Regards,

    Daisy

    Monday, January 22, 2018 9:15 AM