如何使用ado.net连接数据库 [英] how to connect database with ado.net
本文介绍了如何使用ado.net连接数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用ado.net连接数据库
how to connect database with ado.net
推荐答案
在这里,您需要了解有关ADO.NET的所有知识:
MSDN:详细的ADO.NET [使用ADO.NET访问数据 [连接到数据源 [
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[^]
SqlConnection c = new SqlConnection(connectionstring here);
c.open()
不要忘记关闭连接.连接字符串取决于您的应用程序.对于具有Windows身份验证的本地SQL数据库,请使用:
"server = .; database = MyDatabase; integrated security = true"
有关数千个其他连接字符串,请在此处 [
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]
这篇关于如何使用ado.net连接数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文