vbScript Help

448
2
08-14-2012 12:53 PM
DuaneDubey
New Contributor
Hello,

I'm new to ArcGIS.  I have a vbscript that was written for 9.3 that I need to convert to run on 10.1.  I keep getting an unspecified error on the second statement.  I think the problem is with the dbf file but I'm not sure how to resolve the issue.


set gp = CreateObject("esriGeoprocessing.GPDispatch.1")

gp.TableSelect_analysis "Database Connections\\Chancery.odc\\dbo.CDM_ARCCHANCERY2", "C:\\ArcProcessing\\IMP_ARC_CHANCERY.dbf", "Id > 0"



Any help would be greatly appreciated.

Thanks,

Dan
Tags (2)
0 Kudos
2 Replies
curtvprice
MVP Esteemed Contributor
Hello,

I'm new to ArcGIS.  I have a vbscript that was written for 9.3 that I need to convert to run on 10.1. 

set gp = CreateObject("esriGeoprocessing.GPDispatch.1")

gp.TableSelect_analysis "Database Connections\\Chancery.odc\\dbo.CDM_ARCCHANCERY2", "C:\\ArcProcessing\\IMP_ARC_CHANCERY.dbf", "Id > 0"


I highly recommend doing this using Python instead. The old GPDispatch interface is poorly supported if at all.

import arcpy
arcpy.TableSelect_analysis(\
    "Database Connections\\Chancery.odc\\dbo.CDM_ARCCHANCERY2", 
    "C:\\ArcProcessing\\IMP_ARC_CHANCERY.dbf", "Id > 0")


But, you should perhaps try simply running the Table Select tool interactively first to make sure the database connection is set up correctly.
0 Kudos
DuaneDubey
New Contributor
I highly recommend doing this using Python instead. The old GPDispatch interface is poorly supported if at all.

import arcpy
arcpy.TableSelect_analysis(\
    "Database Connections\\Chancery.odc\\dbo.CDM_ARCCHANCERY2", 
    "C:\\ArcProcessing\\IMP_ARC_CHANCERY.dbf", "Id > 0")


But, you should perhaps try simply running the Table Select tool interactively first to make sure the database connection is set up correctly.


Curtis,

Thank you for the tip.  For me it doesn't matter if it is Python or VBScript.  We are more comfortable with VB but we can adapt.  From what I can gather, the script needs four parts.  Here is what I have in my model so far.

1.  Table Select to import data from our SQL Server Database into ArcGIS
2.  Geocode Addresses (connecting the table select and our locator file)
3.  Intersect (connecting the Geocode results to three boundary files (shape files)  * I'm not sure if I need three separate Intersects or if I can have one intersect with three shape files. 
4.  I need to import the results back to SQL Server so that I can run analysis and reports.  I haven't found a tool that will do this for me.  Do I need to create a custom tool to do this?  If so, I'd appreciate some tips to do so.

Thanks again,

Dan
0 Kudos