Click here to Skip to main content
16,018,202 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to connect database with ado.net
Posted

Here you go for all you need to know about ADO.NET:
MSDN: ADO.NET in detail[^]
Accessing Data with ADO.NET[^]

Just to be specific in link:
Connecting to Data Sources[^]
 
Share this answer
 
SqlConnection c = new SqlConnection(connectionstring here);
c.open()


do not forget to close the connection. Connection string depends on your application. for local SQL database with windows authentication, use:
"server=.;database=MyDatabase;integrated security=true"
For thousands of more connection strings, look here[new page]
 
Share this answer
 
v2

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