Click here to Skip to main content
15,908,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to connect sqlserver, using username and password

Well, by using a Connection String[^]!

The link above provides all info about connection string. Further info regarding the data communication can be read here: Accessing data with ADO.NET[^]
Share this answer
JF2015 16-Dec-10 1:52am    
Good one. is one of the most posted answers in the Q&A section :)
Rajesh Anuhya 5-Jan-11 4:10am    
Yes.., is the unique answer for most of the database questions in CP.
SqlConnection conn = new SqlConnection("server=localhost;database=DB_NAME;uid=sa;pwd=1234567");

SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM TABLE_NAME",conn);

DataTable dt = new DataTable();

Completed a period created connection and fill data from sql to datatable in C#. :-O
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