【发布时间】:2015-02-06 10:55:49
【问题描述】:
我有一个 Access 数据库和一个 C# 应用程序。 C# 应用程序对 Access 中的某些表执行了一些操作,我想在 C# 代码结束时刷新 Access 表单。我试着这样做:
void refresh()
{
Access.Application acApp = new Access.ApplicationClass();//create msaccess application
object oMissing = System.Reflection.Missing.Value;
//Run the Test macro in the module
acApp.Run("Function_refresh",ref oMissing,ref oMissing,ref oMissing,ref oMissing,
ref oMissing,ref oMissing,ref oMissing,ref oMissing,
ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing
,ref oMissing,ref oMissing);
acApp.Quit();//exit application
}
如果数据库关闭,我的代码可以工作。如果数据库已经打开,如何使用该功能?
编辑:C# 在 Access 表中做了一些插入,所以当它结束时,我想在它打开时刷新表单。
【问题讨论】:
-
在 Access 中打开数据库文件时会发生什么?
-
它尝试打开另一个数据库。
标签: c# vba ms-access ms-access-2007