0

i have a snippet that it work properly when i use windowsmode with follow connection string

data source=.;database=xDB;integrated security=true;

but i have to change it for sql and windows mode i changeit to

Data Source=.;Initial Catalog=xDB;User Id=krs;Password=12345;

but follow error occur

Login failed for user 'krs'. The user is not associated with a trusted SQL Server connection.

and when change dot(.) to(local) another error occur

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

plz help me im beginer n confused.thank

6
  • Can you Please show here your full Connection String from Web.Config File and have you also tried to log in Sql Server with Same Credential that you are passing here? Commented Sep 25, 2012 at 8:10
  • 1
    To address the secondary issue - it's localhost, not local Commented Sep 25, 2012 at 8:11
  • Did you add this user to your access database? Commented Sep 25, 2012 at 8:13
  • i dont puit inweb config: SqlConnection con = new SqlConnection("Data Source=local;Initial Catalog=xdb;User Id=krs;Password=1234;"); Commented Sep 25, 2012 at 8:18
  • yes imake login and user with krs name in sqlserver Commented Sep 25, 2012 at 8:19

1 Answer 1

2

You have to enable the Named Pipe & TCP/IP in SQL Server configuration. Go through following link to enable that

http://www.triostechs.com/Microsoft-SQL-Server-2008/Microsoft-SQL-Server-2008-Enable-TCP/IP-or-Named-Pipes.html

Also Make sure, only one instance of the SQL Server running. If it is more than one, just verify which one you are connecting to.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.