I recently upgraded a server w/ Engine installed to 10.1 sp1 from 10.0. I have some code in a simple console app that creates XY events from a spreadsheet and then writes those features into a SDE instance. Since the upgrade, the code bombs when I try to open a workspace from the spreadsheet - code below. Any ideas what I'm missing or may have changed from 10.0?Thanks, TG
Console.WriteLine("Import Starting - " + DateTime.Now.ToShortTimeString());
try
{
//Open XLS as table & make XY layer
factoryType = Type.GetTypeFromProgID("esriDataSourcesOleDB.ExcelWorkspaceFactory");
WSFac = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
Console.WriteLine(WSFac.IsWorkspace(strXLSarchive));
Console.WriteLine("Looking for " + strXLSarchive);
Console.WriteLine("does file exists " + File.Exists(strXLSarchive).ToString());
WS = WSFac.OpenFromFile(strXLSarchive, 0); <-- falls into the Catch block here
Console.WriteLine("WS opened");
fWS = (IFeatureWorkspace)WS;
table = fWS.OpenTable(strXLSsheet);
ds = table as IDataset;
XYProps = new XYEvent2FieldsPropertiesClass()
{
XFieldName = strXField,
YFieldName = strYField
};
XYName = new XYEventSourceNameClass()
{
EventProperties = XYProps,
SpatialReference = srWGS84,
EventTableName = ds.FullName
};
XYEvent = (XYName as IName).Open() as IXYEventSource;
fcInput = XYEvent as IFeatureClass;
}
catch (Exception ex)
{
strMsg = "0;Failed to create XYEvents from XLS: " + ex.Message + ";" + ex.GetType().ToString();
Console.WriteLine(strMsg);
WriteLog(strMsg, true);
m_AOLicenseInitializer.ShutdownApplication();
return;
}
strMsg that's echoed and logged is -0;Failed to create XYEvents from XLS: Exception from HRESULT: 0x80040213;System.Runtime.InteropServices.COMException;2/12/2013;1:41:13 PMmy debugging WriteLine statements echo the correct file name and that it does exist.Code runs fine on my PC debugging in VS2010