温州布衣

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"] ;

posted on 2009-03-19 10:38  温州布衣  阅读(321)  评论(2)    收藏  举报