ASP.NET连接各种数据库办法

连接Access数据库:

<appSettings>
    <add key="accessCon" value="Provider=Microsoft.Jet.OLEDB.4.0";Data Source=|DataDirectory|db_access.mdb"/>
</appSettings>

string con_access=ConfigurationManager.AppSettings["accessCon"].ToString();

连接SQLServer

<appSetting>
    <add key="sqlCon" value="Data Source=(local);Database=数据库名称;Uid=sa;Pwd=密码"/>
</appSetting>

string con_sqlserver=ConfigurationManager.AppSettings["sqlCon"].ToString()

 

posted @ 2014-08-05 17:13  波波乐园  阅读(181)  评论(0编辑  收藏  举报