Click here to Skip to main content
16,004,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am trying to connect to sql server through my c# application. But i m facing an error "login failed".
Here is my connection string:
"Data Source=ADMIN-PC;Initial Catalog=Sample;Integrated Security=true"
My sql server 2005 is on windows authentication mode.
Please help me out to solve this problem.
Thank you.
Posted

Here is the correct way to write connectionstring in C#

C#
<connectionstrings>
<add name="dbconnection" connectionstring="Data Source=SureshDasari;Integrated Security=true;Initial Catalog=MySampleDB" providername="System.Data.SqlClient" />
</connectionstrings>
 
Share this answer
 
Comments
Parag Soni 3-Aug-15 5:54am    
It didn't work
Karn Singh 3-Aug-15 5:57am    
can you show me the exact code and error you are getting?
Make sure the account your code is running under has access to the database. Google for configuring windows security with sql server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900