Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using, my custom tool needs to create a data table in my geodatabase to store some information for later use. The user will be in ArcMap 9.3.1 with the geodatabase up and layers displayed. I want to create the table at the same level as the dataset. I can accomplish this with the following:

    gp = CreateObject("esriGeoprocessing.GPDispatch.1")
    gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
    gp.createtable_management("C:\Dan\Data\geodatabase.mdb", TableName, "", "")

However, the problem is I cannot figure out how to have the geodatabase be something other than hardcoded. How do I get the current geodatabase name and use a variable populated with that name in the createtable_management line?

I've searched high and low for two days now with no luck.



share|improve this question
up vote 3 down vote accepted

Well "C:\Dan\Data\geodatabase.mdb" is just a string so you can use a string variable set to some other value.

How you get the current gdb depends on what other objects you have. For example if you have a IDataset its has a Workspace that has a PathName.

Also just to note, I believe that using "esriGeoprocessing.GPDispatch.1" is older syntax, you could use in .net a Geoprocessor object. Check out some of the sdk samples, prefixed with "GP" usually under C:\Program Files\ArcGIS\DeveloperKit\SamplesNET\Desktop\, such as "GPExecutingTools"

share|improve this answer
That got me over the hump. Thank you very much! – user1591 Jan 5 '11 at 22:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.