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()