在Web.Config文件里,怎么写access数据库连接字符串? 各位大侠,请教: 在Web.Config文件里,怎么写access数据库连接字符串? 如这样的形式:<appSettings> <add key="" value=""></add> </appSettings> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;" <appSettings> <add key="connecting" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"></add></appSettings> 你好,lovefootball(蟑螂) : 能写的详细一点吗?加上 <appSettings> </appSettings> <appSettings> <add key="connecting" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"></add></appSettings>你可以参见www.connectionstrings.com "somepath",能用虚拟路径吗? 上传到远程服务器根目录的DataBase目录下,"Data Source=\somepath\mydb.mdb"这一部分该如何写? to "somepath",能用虚拟路径吗?<appSettings><add key="FileFullPath" value="DataBase/mydb.mdb"></add></appSettings>------In your web app-----string strFileFullPath = Server.MapPath( ConfigurationSettings.AppSettings["FileFullPath"] );string strConn = string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", strFileFullPath ); <appSettings> <add key="connecting" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"></add></appSettings> 你好,Knight94(愚翁): 首先,先谢谢你!你讲得更详细。 我想请教一个问题: 我发现了一个问题,使用这种方法时,处在不同层的页面代码不能使用同一个连接字符串,例如: (虚拟目录)目录: /file1/file2/file3 (虚拟目录)数据库目录:/file1/mydb.mdb (虚拟目录)页面目录:页面1目录:/file1/WebForm1 页面2目录:/file1/file2/WebForm2 ---web app---- <appSettings> <add key="FileFullPath1" value="mydb.mdb"></add> <add key="FileFullPath2" value="../mydb.mdb"></add> </appSettings> 页面1的连接字符串: string strFileFullPath = Server.MapPath( ConfigurationSettings.AppSettings["ConnectionString1"] ); string strConn = string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};",strFileFullPath ); 页面2的连接字符串: string strFileFullPath = Server.MapPath( ConfigurationSettings.AppSettings["ConnectionString2"] ); string strConn = string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};",strFileFullPath ); 我想请教: 页面1和页面2能不能使用同一个连接字符串? 是我的用法有问题?还是只能这样用?还是还有别的方法? to 页面1和页面2能不能使用同一个连接字符串?你可以在webapp中的Global文件去做,然后存在session中,那么页面访问的时候,直接从session去取即可。 to 你可以在webapp中的Global文件去做,然后存在session中,那么页面访问的时候,直接从session去取即可 在Global文件中怎么做?怎么存到session中,你能详细的说一下吗?谢谢 <appSettings> <add key="connecting" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mydb.mdb;Jet OLEDB:Database Password=sa;"></add></appSettings> to 在Global文件中怎么做?怎么存到session中,你能详细的说一下吗?protected void Session_Start(Object sender, EventArgs e){ //Get app setting try { string strFileFullPath = Server.MapPath( ConfigurationSettings.AppSettings["FileFullPath"] ); string strConn = string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};",strFileFullPath ); Application["ConnectionString"] = strConn; } catch(Exception err) { Application["ErrorString"]=err.Message; }} 谢谢各位大侠的帮助!特别感谢Knight94(愚翁)! 窗体传值无法显示在文本框中 客户端如何能访问到服务器端的图像文件? 砬到一个数据组合的问题,请教各位高手帮忙解决 这个winform的连接字符串要怎么写,需要怎么配制sql(需求比较麻烦) 是我无知,还是CSDN里没有高手,彻底理解MVC者进来... asp.net关于Request.UrlReferrer C#中的级联菜单问题. (高分求助) c# 概率算法 一个怪问题~~ 线程中show 窗口的问题 我建一个表TNOChosed,列Id的标识是“是”,标识种子为“1”,增量“1”。把这个表放到虚拟空间里面去后插入就报错 在C#中使用Scoket传送类?
<add key="connecting" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"></add>
</appSettings>
能写的详细一点吗?加上
<appSettings>
</appSettings>
<add key="connecting" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"></add>
</appSettings>你可以参见www.connectionstrings.com
上传到远程服务器根目录的DataBase目录下,"Data Source=\somepath\mydb.mdb"这一部分该如何写?
<add key="FileFullPath" value="DataBase/mydb.mdb"></add>
</appSettings>------In your web app-----
string strFileFullPath = Server.MapPath( ConfigurationSettings.AppSettings["FileFullPath"] );
string strConn = string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};",
strFileFullPath );
<add key="connecting" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"></add>
</appSettings>
首先,先谢谢你!你讲得更详细。
我想请教一个问题:
我发现了一个问题,使用这种方法时,处在不同层的页面代码不能使用同一个连接字符串,例如:
(虚拟目录)目录: /file1/file2/file3
(虚拟目录)数据库目录:/file1/mydb.mdb
(虚拟目录)页面目录:页面1目录:/file1/WebForm1
页面2目录:/file1/file2/WebForm2
---web app----
<appSettings>
<add key="FileFullPath1" value="mydb.mdb"></add>
<add key="FileFullPath2" value="../mydb.mdb"></add>
</appSettings>
页面1的连接字符串:
string strFileFullPath = Server.MapPath( ConfigurationSettings.AppSettings["ConnectionString1"] );
string strConn = string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};",strFileFullPath );
页面2的连接字符串:
string strFileFullPath = Server.MapPath( ConfigurationSettings.AppSettings["ConnectionString2"] );
string strConn = string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};",strFileFullPath ); 我想请教:
页面1和页面2能不能使用同一个连接字符串?
是我的用法有问题?还是只能这样用?还是还有别的方法?
在Global文件中怎么做?怎么存到session中,你能详细的说一下吗?谢谢
<add key="connecting" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mydb.mdb;Jet OLEDB:Database Password=sa;"></add>
</appSettings>
protected void Session_Start(Object sender, EventArgs e)
{
//Get app setting
try
{
string strFileFullPath = Server.MapPath( ConfigurationSettings.AppSettings["FileFullPath"] );
string strConn = string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};",
strFileFullPath );
Application["ConnectionString"] = strConn;
}
catch(Exception err)
{
Application["ErrorString"]=err.Message;
}
}