asp.net配置文件连接Access
ASP.net连接ACCESS的问题
配置文件是这样写的
<appSettings>
<add key= "DSN " value= "../DataBase/ghgj.mdb "> </add>
</appSettings>
读是这样读的:
string strCon = System.Configuration.ConfigurationSettings.AppSettings[ "DSN "];
但是有错误啊,帮我分析下,应该是连接串的问题,我第一次连Access,还有路径一定要相对的
------解决方案--------------------请看
www.xproer.com/bbs -- "技术交流区 " -- "数据库开发 " -- "在.NET中连接ACCESS数据库语句 "这篇文章
------解决方案-------------------- <add key= "DSN " value= "/xxx/xxxx/DataBase/ghgj.mdb "> </add>
------解决方案--------------------string strCon = System.Configuration.ConfigurationSettings.AppSettings[ "DSN "];
strCon = Server.MapPath(strCon);
------解决方案--------------------see:
http://community.csdn.net/Expert/topic/4855/4855458.xml?temp=.6334955
------解决方案--------------------..换成~
然后在cs文件中用Server.Mappath
------解决方案-------------------- <appSettings>
<add key= "con " value= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= "> </add>
<add key= "data " value= "/Data/mdb "> </add>
</appSettings>
string myCon=System.Configuration.ConfigurationSettings.AppSettings[ "con "]+ HttpContext.Current.Server.MapPath( "~ " + System.Configuration.ConfigurationSettings.AppSettings[ "data "]);