Hi, I am using this method to open the geodatabase:
public OleDbConnection ArcSdeConnectionWithString(String server, String userId, String password, String geometry, String instance, String version)
{
String blankSdeConnectionString = "Provider=ESRI.GeoDB.OleDB.1;Location={0};Data Source=ekndkonv;User Id={1};Password={2};" + "Extended Properties=workspacetype=esriCore.SdeWorkspaceFactory.1;Geometry={3};Instance={4};Version={5}";
String connectionString = String.Format(blankSdeConnectionString, server, userId, password, geometry, instance, version);
OleDbConnection sdeConn = new OleDbConnection();
sdeConn.ConnectionString = connectionString;
return sdeConn;
}
And then in a separate method:
OleDbConnection conn = eoledb.ArcSdeConnectionWithString("ip address of my server", "userid", "password", "WKB", "5121", "SDE.DEFAULT");
conn.Open();
OleDbCommand cmd = new OleDbCommand("SELECT OBJECTID FROM tableName", conn);
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader["OBJECTID"].ToString());
}
conn.Close();
Connection opens, so the connection string should be OK, but once the execution reaches the line where " cmd.ExecuteReader();" is called, it crashes down with the following message:
"Windows has triggered a breakpoint in MyApp.exe.
This may be due to a corruption of the heap, which indicates a bug in MyApp.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while MyApp.exe has focus.
The output window may have more diagnostic information."
The query seems ok, very simple, I examined it with OracleConnection and OracleCommand, it ran perfectly well, but I want to use "ESRI.GeoDB.OleDB.1" as Provider instead of Oracle provider, because it supports versioning of the SDE database- as in the method above. But this approach does not work for me. I would like to execute a bit more complicated queries against Oracle SDE DB in the future that include "join", "groupe by" or "having" statements, but for some reason I cannot run a simple query with "ESRI.GeoDB.OleDB.1" provider. Can anybody tell me why? What am I doing wrong?
Your help is very appreciated!