.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

connection string

Posted By: softraj     Posted Date: May 10, 2010    Points:2   Category :Sql Server
Hi, I have been using sqlserver 2000. I used to login into query analyzer using windows authentication instead of using sqlserver authentication. Now I need to acces data from sqlserver into .net application. How should I write the connection string for .net application to acces data from sqlserver using windows authentication.

Responses
Author: Nikhil Kumar             
Posted Date: May 10, 2010     Points: 5   

SqlConnection con = new SqlConnection();
con.ConnectionString = "Data source=yourdatasource; InitialCatalog = urs;Integrated Security = True;";
con.Open();

Thats it

Be helpful and enjoy life because it comes only onces. Give all the happiness to yours and remember it doesn't comes by money ...
Author: Lalij Mer             
Posted Date: May 10, 2010     Points: 5   

Hi,

you will get connection string from this link


http://www.connectionstrings.com/access

Please Check my answer if you help....
Thank You...

Lalit.
Author: softraj             
Posted Date: May 12, 2010     Points: 5   

I used the following connection string to connect to sql server through windows authentication:

SqlConnection con = new SqlConnection();
con.ConnectionString = "Data source=localhost; InitialCatalog = Northwind;Integrated Security = True;";

But am getting an error message "login failed for the user xxxxxxx".


Can u help me

Author: softraj             
Posted Date: May 12, 2010     Points: 5   

I used the following connection string to connect to sql server through windows authentication:

SqlConnection con = new SqlConnection();
con.ConnectionString = "Data source=localhost; InitialCatalog = Northwind;Integrated Security = True;";

But am getting an error message "login failed for the user xxxxxxx".


Can u help me

Author: Usha             
Posted Date: May 12, 2010     Points: 5   

Hi Softraj,

As your connection string is right, Plz check for Data source name.
It might be different than localhost.

thanks & regards,
Usha.

Author: Nikhil Kumar             
Posted Date: May 12, 2010     Points: 5   

hey friend here is a error in code line

Security = True;";

should be this.
Security = True";

Be helpful and enjoy life because it comes only onces. Give all the happiness to yours and remember it doesn't comes by money ...
Author: BangaruBabuPureti             
Posted Date: May 13, 2010     Points: 5   

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

BangaruBabu Pureti
http://bangarubabupureti.spaces.live.com/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend