OpenTable

1229
4
09-20-2011 09:47 AM
ElizabethWare
New Contributor
I am trying to open a .CSV in c# using the IFeatureWorkspace.OpenTable, but for some reason I am getting an error that has no error message:
((System.Runtime.InteropServices.ExternalException)(com)).ErrorCode -2147220655.

Here is the code:

IWorkspaceFactory pFact;
IFeatureWorkspace pFeatws;
ITable pTable;     // Table to Geocode.
//IWorkspace pWorkspace;
           
// Create pTable from .csv file...
pFact = new TextFileWorkspaceFactory();
pFeatws = (IFeatureWorkspace)pFact.OpenFromFile(LocalFolder, 0);

//pFeatws = (IFeatureWorkspace)pWorkspace;
pTable = pFeatws.OpenTable(CSVFile);    //open the .csv file...

This seems to work with other clients, but this is the first one that I Have created the GeoCoding.
0 Kudos
4 Replies
SteveFang
New Contributor III
Does your code work for another CSV file?  If so then you probably need to examine your Geocoding CSV file to make sure there is no special character or file permission issues that is causing your C# exception.
0 Kudos
OlivierVoyer
New Contributor II
I have the exact same problem. I cannot open a very simple CSV file as a ITable...

Thank you.
0 Kudos
ElizabethWare1
New Contributor

I am having this issue with 10.7. I get an error, but no error really explaining why it is erroring. This worked fine in 9.3. Please help me get past this.

0 Kudos
ElizabethWare1
New Contributor

Here is my code snippet:

IWorkspaceFactory pFact;
IWorkspace pWorkspace;
IFeatureWorkspace pFeatws;

// Create pTable from .csv file...
pFact = new TextFileWorkspaceFactory();
pWorkspace = pFact.OpenFromFile(LocalFolder, 0); -- LocalFolder is where CSV files are located

pFeatws = (IFeatureWorkspace)pWorkspace;
pTable = pFeatws.OpenTable(CSVFile);

0 Kudos