public void CreateMdbfile(string strMdbFileName)
{
if (!File.Exists(strMdbFileName))
{
string mdbfileName = System.IO.Path.GetFileNameWithoutExtension(strMdbFileName); //test
string fileName = System.IO.Path.GetFileName(strMdbFileName);//返回文件名 test.mdb
string fileDirectory = System.IO.Path.GetDirectoryName(strMdbFileName);//返回文件目录 f://temp
if (mdbfileName == "") return;
IWorkspaceFactory workspaceFactory = new AccessWorkspaceFactoryClass();
IWorkspaceName workspaceName = workspaceFactory.Create(fileDirectory, mdbfileName, null, 0);
IName name = workspaceName as IName;
IWorkspace workspace = (IWorkspace)name.Open();
IFeatureWorkspace pFeWs = workspace as IFeatureWorkspace;

this.Close();
this.Dispose();
}
else
{
MessageBox.Show("文件夹下已存在该mdb文件,请先删除");
}

}

相关文章:

  • 2021-11-14
  • 2022-12-23
  • 2021-12-30
  • 2021-09-07
  • 2022-12-23
  • 2021-08-17
  • 2021-12-01
  • 2021-11-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
  • 2021-08-20
  • 2021-09-03
  • 2022-12-23
  • 2021-07-06
相关资源
相似解决方案