编一小程序遇到哨卡,希望得到帮助

punypony 2006-01-21 10:43:50
编一小程序遇到哨卡,希望得到帮助,现描述如下:

程序运算结果保存在Data.mdb中,

使用ado与datagrid连接显示数据,

想将运算结果Data.mdb另存,代码如下所示

但总是提示“拒绝的权限,70”错误,

尝试多次,万般无奈之下请教各位

望给予指点,非常感谢!

Private Sub SaveAsAccessFile_Click()



Dim filecopyme As String



Set gridData.DataSource = Nothing

adoData.Recordset.Close

adoData.RecordSource = ""

adoData.ConnectionString = ""



CommonDialog3.FilterIndex = 1

pathofme = App.Path

filecopyme = cstr(App.Path) & "\Data.mdb"



CommonDialog3.ShowSave

FileCopy filecopyme, CommonDialog3.FileName



End Sub
...全文
103 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
rainstormmaster 2006-01-21
  • 打赏
  • 举报
回复
这样试试:
dim mfile as string
dim buff() as byte
dim i as long
mfile=你的mdb文件路径
i=filelen(mfile)
redim buff(i-1)
open mfile for binary as #1
get #1,,buff
close #1
dim mfile1 as string
mfile1=你要另存的文件路径
open mfile1 for binary as #1
put #1,,buff
close #1
bbhere 2006-01-21
  • 打赏
  • 举报
回复
如果在操作时数据库被打开(除非你的数据库是以只读方式打开的),读文件操作会被禁止,所以无法拷贝文件。解决的办法就是暂时关闭数据库(包括数据控件)。
punypony 2006-01-21
  • 打赏
  • 举报
回复
请教如何关闭已经打开的文件,谢谢。
bbhere 2006-01-21
  • 打赏
  • 举报
回复
看看文件是不是已经打开

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧