This document is archived and information here might be outdated.  Recommended version.


How to create a new personal geodatabase (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > Appendix: ArcObjects in Visual C++ > Samples > Geodatabase > Schema creation and management > How to create a new personal geodatabase

How to create a new personal geodatabase


This sample will demonstrate the how to create a new personal geodatabase stored in an .mdb file.

How to use

  1. Paste the function in your project.
  2. Call the function from your code.
[VCPP]
//
// createAccessWorkspace
// NOTE:
//   Location does not have to contain ending '\'.  Also name should not contain .mdb extension
//
HRESULT createAccessWorkspace(BSTR location, BSTR name, IWorkspaceName
  **ppOutWorkspaceName)
{

  if (ppOutWorkspaceName == NULL)
    return E_POINTER;

  HRESULT hr;
  CComPtr < IWorkspaceFactory > ipWkspFact;
  ipWkspFact.CoCreateInstance(CLSID_AccessWorkspaceFactory);

  return ipWkspFact->Create(location, name, NULL, NULL, ppOutWorkspaceName);
}






Development licensing Deployment licensing
Engine Developer Kit Engine