Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005

    Unanswered: How to connect to DB with username and passwd?

    Hi I've created a login in my SQL Server 2005 like this:

    CREATE LOGIN testuser
    USE DB1;
    CREATE USER testuser FOR LOGIN testuser;

    now i want to connect from a c# app with the following connection STring
    "Data Source=TURM21;Initial Catalog= Db1; Database= Db1 ; USER = testuser; PASSWORD = TestPWD; pooling=false; "

    and i get the following Exception:
    SqlConnection Handle : 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.)

    CAn somebody help me? Whats wrong? Is it my connection string?


  2. #2
    Join Date
    Feb 2006
    You should use GRANT statement to grant to this user privillege use the DB1 before use that username to login to DB

  3. #3
    Join Date
    Nov 2005
    have granted access to user manually in DB.

    Changed the Conn String an d now it works:

    "Data Source=TURM21; Database= Db1 ; USER id= testuser; PASSWORD = testPWD; Trusted_Connection=True ";

    Set the Trusted_Connection to true

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts