从一个文件夹向另一个文件夹写入访问数据库. [英] write access db from one folder to another.

查看:107
本文介绍了从一个文件夹向另一个文件夹写入访问数据库.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将ms access db从一个文件夹写入另一个文件夹,而没有任何危险.我尝试了一些代码,但它给出了这样的错误
"

I want to write the ms access db from one folder to another with out any dattalose. I try some code but it giving error like this
"

Access to the path 'C:\Documents and Settings\Duane.DGAGENCI-FA286T\My Documents\ECatalog\ECatalog Update\Database\CANASIA TOYS & GIFTS' is denied.

"

这是我的代码,我可以从中更改

"

Here is my code wat i can change from this

if (File.Exists("C:\\Documents and Settings\\Duane.DGAGENCI-FA286T\\My Documents\\ECatalog\\ECatalog Update\\Database\\CANASIA TOYS & GIFTS\\CANASIA TOYS & GIFTS PRODUCTS.mdb"))
                {
                    File.Delete("C:\\Documents and Settings\\Duane.DGAGENCI-FA286T\\My Documents\\ECatalog\\ECatalog Update\\Database\\CANASIA TOYS & GIFTS\\CANASIA TOYS & GIFTS PRODUCTS.mdb");
                }
                string path1 = "C:\\Documents and Settings\\Duane.DGAGENCI-FA286T\\My Documents\\ECatalog\\ECatalog Update\\Database\\CANASIA TOYS & GIFTS";
                byte[] ReadDb = ReadFile("C:\\Documents and Settings\\Duane.DGAGENCI-FA286T\\My Documents\\Canasia\\ECatalog April 12-1\\MergeMacro\\CANASIA TOYS & GIFTS PRODUCTS.mdb");
                MemoryStream msdb = new MemoryStream(ReadDb);
                FileStream fsdb = new FileStream(path1, FileMode.Open, FileAccess.ReadWrite);
                byte[] writedb = msdb.ToArray();
                fsdb.Write(writedb, 0, writedb.Length);
                msdb.Close();
                fsdb.Close();


任何人请解决问题.我无法解决该问题,请在c#.net


anyone please solve the problem. i could not solve that issue please send charect coding in c#.net

推荐答案

中发送charect编码,似乎您没有对目标目录的正确特权.您可以修改目录的特权或提高代码的特权.

另外,也许您可​​以只使用复制 [
Seems that you don''t have right privileges to the target directory. You could modify the privileges of the directory or raise the privileges of your code.

Also perhaps you could simply use Copy[^]

Additional warning: If someone is accessing and modifying the database at the time you copy it, the result may not be usable.


这篇关于从一个文件夹向另一个文件夹写入访问数据库.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆