Making a connection to a workspace is the foundation to accessing data. This sample will show you how to connect to a file geodatabase stored in an .gdb file. The example code is a function that takes the path to the File geodatabase as a string and returns a workspace.
How to use
- Paste the function in your project.
- Call the function from your code.
// connString should be full path to a .gdb folder, i.e.:
// L"C:\\Data\\Landbase.gdb"
HRESULT openFGDBWorkspace(BSTR connString, IWorkspace **outWorkspace)
{
IWorkspaceFactoryPtr ipWorkspaceFactory(CLSID_FileGDBWorkspaceFactory);
return ipWorkspaceFactory->OpenFromFile(connString, NULL, outWorkspace);
}
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |