首页 > 代码库 > ASP.NET连接各种数据库办法

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

连接Access数据库:

<appSettings>    <add key="accessCon" value=http://www.mamicode.com/"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=http://www.mamicode.com/"Data Source=(local);Database=数据库名称;Uid=sa;Pwd=密码"/></appSetting>string con_sqlserver=ConfigurationManager.AppSettings["sqlCon"].ToString()