I'm able to connect to an ESRI fgdb using an OleDbDataAdapter and read the attribute table just fine - from within visual studio. However, when I put the code inside a windows service it crashes (no error, just kills the service). The line it crashes on is commented in the code below (when executing the reader).
Dim fgdbPath as String = "c:\esridata\myfgdb.gdb" Dim tableName as String = "TableXX" Dim conn as OleDbConnection = New OleDb.OleDbConnection("Provider=ESRI.GeoDB.OleDB.1;Data Source=" & fgdbPath & ";Extended Properties=WorkspaceType=esriDataSourcesGDB.FileGDBWorkspaceFactory.1;Geometry=WKB") Dim reader As OleDbDataReader = Nothing Try conn.Open() Dim cmd As New OleDbCommand("Select top 2 ID, CITY FROM " & tableName, conn) reader = cmd.ExecuteReader() ' crashes here!
I also tried using an OleDbDataAdapter.Fill(DataSet, tableName) but it would crash on this line as well.
The service will run forever as long as it doesn't hit the above line of code. The try/catch block doesn't catch the error either.
If I can't get this to work, I suppose I could use arcobjects and a cursor but that's the last resort.
Note: I'm using ArcGis 10, .net framework 3.5, vs 2008