//根据Mdb文件获得workspace
public static IWorkspace OpenMdbWorkSpace(String MdbFileName)
{
IWorkspaceFactory pWSFact = new AccessWorkspaceFactoryClass();
IWorkspace pWor = pWSFact.OpenFromFile(MdbFileName, 0);
return pWor;
}
HRESULT:0x80040213 OpenFromFile
是MdbFileName文件不存在,正确的写法为:
//根据Mdb文件获得workspace
public static IWorkspace OpenMdbWorkSpace(String MdbFileName)
{
if (File.Exists(MdbFileName))
{
IWorkspaceFactory pWSFact = new AccessWorkspaceFactoryClass();
IWorkspace pWor = pWSFact.OpenFromFile(MdbFileName, 0);
return pWor;
}
else
{
return null;
}
}