asp.net连接access,sql server
webconfig
<appSettings>
<!-- 连接字符串 -->
<add key="sqlConnectionString" value="server=127.0.0.1;database=codematic;uid=sa;pwd="/>
<add key="connectionString" value="Provider=Microsoft.Jet.OleDb.4.0;Data source="/>
<add key="oleFile" value="/news.mdb;"/>
</appSettings>
读取连接路径
// Access连接配置
ConfigurationManager.AppSettings["connectionString"] +System.Web.HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["oleFile"].Trim());
//sql server 连接配置
ConfigurationManager.AppSettings["sqlConnectionString"] ;
浙公网安备 33010602011771号