private bool OpenConnection(SdeConnection sdeConnection, IDataset dataset) { _errMsg = ""; if (sdeConnection.SeConnection.handle != IntPtr.Zero) { CloseConnection(sdeConnection); } string server = ConfigTextStream.ExtractValue(_connectionString, "server"); string instance = ConfigTextStream.ExtractValue(_connectionString, "instance"); string database = ConfigTextStream.ExtractValue(_connectionString, "database"); string username = ConfigTextStream.ExtractValue(_connectionString, "usr"); string password = ConfigTextStream.ExtractValue(_connectionString, "pwd"); string pooling = ConfigTextStream.ExtractValue(_connectionString, "pooling"); if (!String.IsNullOrWhiteSpace(pooling) && (pooling.ToLower() == "false" || pooling.ToLower() == "no")) { sdeConnection.Pooling = false; } else { sdeConnection.Pooling = true; } sdeConnection.Dataset = dataset; SE_ERROR error = new SE_ERROR(); try { System.Int32 errCode = Wrapper10.SE_connection_create( server, instance, database, username, password, ref error, ref sdeConnection.SeConnection); if (errCode != 0) { error.sde_error = errCode; _errMsg = errCode + " " + Wrapper10.GetErrorMsg(sdeConnection.SeConnection, error); return(false); } } catch (Exception ex) { _errMsg = "SDE ERROR: " + ex.Message; return(false); } return(true); }
private bool OpenConnection(SdeConnection SdeConnection) { if (SdeConnection.SeConnection.handle != 0) { CloseConnection(SdeConnection); } string server = ConfigTextStream.ExtractValue(_connectionString, "server"); string instance = ConfigTextStream.ExtractValue(_connectionString, "instance"); string database = ConfigTextStream.ExtractValue(_connectionString, "database"); string username = ConfigTextStream.ExtractValue(_connectionString, "usr"); string password = ConfigTextStream.ExtractValue(_connectionString, "pwd"); SE_ERROR error = new SE_ERROR(); try { if (Wrapper92.SE_connection_create( server, instance, database, username, password, ref error, ref SdeConnection.SeConnection) != 0) { _errMsg = Wrapper92.GetErrorMsg(SdeConnection.SeConnection, error); return(false); } } catch (Exception ex) { _errMsg = "SDE ERROR: " + ex.Message; return(false); } return(true); }
protected override SdeConnection OpenConnection(IDataset dataset) { _errMsg = ""; SdeConnection connection = new SdeConnection(); string server = ConfigTextStream.ExtractValue(_connectionString, "server"); string instance = ConfigTextStream.ExtractValue(_connectionString, "instance"); string database = ConfigTextStream.ExtractValue(_connectionString, "database"); string username = ConfigTextStream.ExtractValue(_connectionString, "usr"); string password = ConfigTextStream.ExtractValue(_connectionString, "pwd"); SE_ERROR error = new SE_ERROR(); try { if (Wrapper92.SE_connection_create( server, instance, database, username, password, ref error, ref connection.SeConnection) != 0) { _errMsg = Wrapper92.GetErrorMsg(connection.SeConnection, error); return(null); } } catch (Exception ex) { _errMsg = "SDE ERROR: " + ex.Message; return(null); } return(connection); }
public static extern Int32 SE_connection_create(string server, string instance, string database, string username, string pwd, ref SE_ERROR error, out IntPtr pSdeConn);