易截截图软件、单文件、免安装、纯绿色、仅160KB

Access数据库在C#.net下的存储路径问题

即使我将数据库放在项目内建的文件夹db下,可是进行存储操作的时候,数据表没有任何变化。后来发现储存改变发生在bin\\debug\\db目录下的数据库中,这个数据库是在程序运行时自动复制过去的,可是为什么存储变化没有反应到外面项目内的数据库db下呢?我想连接字符串中datasource中的datadirectory存在一些玄机,于是我找到一个改变存储路径的方法,以实现对数据库操作能落实到你指定的项目数据库文件中。
        //改变数据库存储路径
   string p = AppDomain.CurrentDomain.BaseDirectory;//获取操作的直接路径
   //重新定位数据库
   if (p.IndexOf("\\bin\\") > 0)
   {
         if (p.EndsWith("\\bin\\Debug\\"))
         p = p.Replace("\\bin\\Debug", "");
         if (p.EndsWith("\\bin\\Release\\"))
         p = p.Replace("\\bin\\Release", "");
   }
   if (!p.EndsWith("App_Data\\"))
         p = p + "db\\";
         p = p + "App_Data\\";//这里可以指定项目数据库文件夹名
   AppDomain.CurrentDomain.SetData("DataDirectory", p);
   Application.EnableVisualStyles();
   Application.SetCompatibleTextRenderingDefault(false);
  其实最后bin\\debug\\db下还是会有一份数据库文件,但是进行的操作可以落实反应到外面项目里数据库文件了。App.config文件里的连接字符串为:connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|数据库名.mdb"



相关文档:

C# ASP.NET 获取脚本语句并用文本的方式显示出来

protected void Button6_Click(object sender, EventArgs e)
    {
        this.Label11.Text = HtmlEncode(this.TextBox3.Text);
 
       
    }
    protected static string HtmlEn ......

access 分页用 SQL查询语句

select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) order by id desc
select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) ......

mysql access deined

我的系统是ubuntu6.06,最近新装好的mysql在进入mysql工具时,总是有错误提示:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password 'newpassword'
Enter password:
m ......

VS2005中,access对只读目录的属性判断不准确

只读目录,
C:\>attrib +A +S +H +R testdir
C:\>attrib testdir
A  SHR     C:\testdir
(1)VC6.0的执行结果:
***********test stat***********************
file [c:\testdir] exists!
file [c:\testdir] is directory!
file [c:\testdir] can be read!
file [c:\testdir] can n ......

Access 类型转换函数

 前言
    最近一直在做Access数据导入Oracle的一个程序,尽管项目已经完成,但是有时也会遇到问题,最主要还是对Access不熟悉的原因,特别是类型转换,而这个是我这个项目中一定会遇到的。所以看到这样一篇文章挺好的,就转过来了。
转贴地址:http://www.cnblogs.com/wf225/archive/2008/10/09/130 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号