public static System.Data.DataSet SearchAssignments(int IncidentNumber, int Department, int Division, System.DateTime MinAssignmentDate, System.DateTime MaxAssignmentDate, string Resolution) { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "Council_SearchAssignments"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand, IncidentNumber, Department, Division, MinAssignmentDate, MaxAssignmentDate, Resolution); return(db.ExecuteDataSet(dbCommand)); }
public static void LogUsersLogOut(string SessionId) { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "Council_LogUserLogOut"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand, SessionId); db.ExecuteNonQuery(dbCommand); }
public static System.Data.DataSet SelectDivisionIncidents(int divisionId, string status) { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "Council_SelectDivisionIncidents"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand, divisionId, status); return(db.ExecuteDataSet(dbCommand)); }
/// <summary> /// 构造函数。 /// </summary> /// <param name="dataEntity"></param> /// <param name="_dbCommand"></param> /// <param name="isMainEntity"></param> public EntityDbCommandInfo(object dataEntity, System.Data.Common.DbCommand dbCommand, bool isMainEntity) { _DataEntity = dataEntity; _DbCommand = dbCommand; _IsMainEntity = isMainEntity; _OperationType = MB.Orm.Enums.OperationType.None; }
public static System.Data.Common.DbCommand CreateCommand(string SQL, int timeout) { System.Data.Common.DbCommand cmd = m_fact.CreateCommand(); cmd.CommandText = SQL; cmd.CommandTimeout = timeout; return(cmd); } // End Function CreateCommand
public static System.Data.DataSet SelectAdminOVerDueIncidents() { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "Council_SelectAdminOverDueIncidents"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); return(db.ExecuteDataSet(dbCommand)); }
private System.Data.Common.DbCommand GenerateDeleteCommand(System.Data.DataRow row) { string tableName = row.Table.TableName; StringBuilder sb = new StringBuilder(); sb.Append("DELETE FROM "); sb.Append(tableName); sb.Append(" WHERE "); for (int i = 0; i < row.Table.Columns.Count; ++i) { System.Data.DataColumn column = row.Table.Columns[i]; if (!IsInColumns(OperateType.Delete, column.ColumnName, true)) { continue; } //if (column.ColumnName == idName) // continue; string s1 = column.ColumnName; string s2 = "@DELETE_Original" + i.ToString(); sb.Append("[" + s1 + "]" + " = " + s2); sb.Append(" AND "); } // remove last AND sb.Remove(sb.Length - 5, 5); System.Data.Common.DbParameter parameter; System.Data.Common.DbCommand cmd = DbHelper.Instance.Database.GetSqlStringCommand(sb.ToString()); for (int i = 0; i < row.Table.Columns.Count; ++i) { System.Data.DataColumn column = row.Table.Columns[i]; if (!IsInColumns(OperateType.Delete, column.ColumnName, true)) { continue; } string s1 = column.ColumnName; string s2 = "@DELETE_Original" + i.ToString(); if (row[column.ColumnName, System.Data.DataRowVersion.Original] != System.DBNull.Value) { parameter = DbHelper.Instance.Database.DbProviderFactory.CreateParameter(); parameter.ParameterName = s2; parameter.Value = row[column.ColumnName, System.Data.DataRowVersion.Original]; cmd.Parameters.Add(parameter); } else { cmd.CommandText = cmd.CommandText.Replace("[" + s1 + "]" + " = " + s2, "[" + s1 + "]" + " IS NULL "); } } return(cmd); }
public static System.Data.DataSet SearchDepartmentIncidents(int IncidentNumber, string FirstName, string LastName, int ProblemTypeId, string Council, string Address, string Description, System.DateTime MinOpenDate, System.DateTime MaxOpenDate, string Status, int departmentId) { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "Council_SearchDepartmentIncidents"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand, IncidentNumber, FirstName, LastName, ProblemTypeId, Council, Address, Description, MinOpenDate, MaxOpenDate, Status, departmentId); return(db.ExecuteDataSet(dbCommand)); }
/// <summary> /// Produces a HTML table string from a <see cref="System.Data.Common.DbCommand"/> /// </summary> /// <param name="command"> /// A database command. /// </param> public static string ToHtmlTable(this System.Data.Common.DbCommand command) { if (command == null) { throw new System.ArgumentNullException(nameof(command)); } return(ToHtmlTable(command.CommandText, command.Connection.ConnectionString)); }
/// <summary> /// Readers the executed. /// </summary> /// <param name="command">The command.</param> /// <param name="interceptionContext">The interception context.</param> public override void ReaderExecuted(System.Data.Common.DbCommand command, DbCommandInterceptionContext <System.Data.Common.DbDataReader> interceptionContext) { var debugHelperUserState = interceptionContext.UserState as DebugHelperUserState; if (debugHelperUserState != null) { System.Diagnostics.Debug.WriteLine(string.Format("\n/* Call# {0}: ElapsedTime [{1}ms]*/\n", debugHelperUserState.CallNumber, debugHelperUserState.Stopwatch.Elapsed.TotalMilliseconds)); } }
/// <summary> /// Loads the catagories. /// </summary> /// <returns></returns> public static System.Data.DataSet LoadCatagories() { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "Council_LoadCatagories"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); return(db.ExecuteDataSet(dbCommand)); }
/// <summary> /// Gets the departments. /// </summary> /// <returns></returns> public static System.Data.DataSet GetDepartments() { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "GetDepartments"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); return(db.ExecuteDataSet(dbCommand)); }
/// <summary> /// Gets the divisions. /// </summary> /// <param name="departId">The depart id.</param> /// <returns></returns> public static System.Data.DataSet GetDivisions(int departId) { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "GetDivision"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "deptId", DbType.Int32, departId); return(db.ExecuteDataSet(dbCommand)); }
private void GetUserIDByName() { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "Council_GetUserIDByName"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand, this._userName); this._userId = Convert.ToInt32(db.ExecuteScalar(dbCommand)); }
/// <summary> /// </summary> /// <param name="command"></param> /// <param name="interceptionContext"></param> /// <inheritdoc /> public override void ReaderExecuting(System.Data.Common.DbCommand command, DbCommandInterceptionContext <System.Data.Common.DbDataReader> interceptionContext) { if (RockContext != null && !interceptionContext.DbContexts.Any(a => a == RockContext)) { return; } DebugHelper._callCounts++; System.Diagnostics.Debug.WriteLine("\n"); StackTrace st = new StackTrace(1, true); var frames = st.GetFrames().Where(a => a.GetFileName() != null); System.Diagnostics.Debug.WriteLine(string.Format("/* Call# {0}*/", DebugHelper._callCounts)); System.Diagnostics.Debug.WriteLine(string.Format("/*\n{0}*/", frames.ToList().AsDelimited(""))); System.Diagnostics.Debug.WriteLine("BEGIN\n"); var declares = command.Parameters.OfType <System.Data.SqlClient.SqlParameter>() .Select(p => { if (p.SqlDbType == System.Data.SqlDbType.NVarChar) { return(string.Format("@{0} {1}({2}) = '{3}'", p.ParameterName, p.SqlDbType, p.Size, p.SqlValue.ToString().Replace("'", "''"))); } if (p.SqlDbType == System.Data.SqlDbType.Int) { return(string.Format("@{0} {1} = {2}", p.ParameterName, p.SqlDbType, p.SqlValue ?? "null")); } else if (p.SqlDbType == System.Data.SqlDbType.Udt) { return(string.Format("@{0} {1} = '{2}'", p.ParameterName, p.UdtTypeName, p.SqlValue)); } else { return(string.Format("@{0} {1} = '{2}'", p.ParameterName, p.SqlDbType, p.SqlValue)); } }).ToList().AsDelimited(",\n"); if (!string.IsNullOrEmpty(declares)) { System.Diagnostics.Debug.WriteLine("DECLARE\n" + declares + "\n\n"); } System.Diagnostics.Debug.WriteLine(command.CommandText); System.Diagnostics.Debug.WriteLine("\nEND\nGO\n\n"); if (interceptionContext.UserState == null) { interceptionContext.UserState = new DebugHelperUserState { CallNumber = DebugHelper._callCounts, Stopwatch = Stopwatch.StartNew() }; } }
public int EmpleadoActivo(string NumeroDeEmpleado) { Database namedDB = factory.Create("Produccion"); string sql = "SELECT COUNT(1) FROM VwFechaDeEgresoPersonal WHERE NumeroDeEmpleado =@NumeroDeEmpleado AND FechaDeEgreso IS NULL"; System.Data.Common.DbCommand sqlCommand = namedDB.GetSqlStringCommand(sql); namedDB.AddInParameter(sqlCommand, "NumeroDeEmpleado", DbType.String, NumeroDeEmpleado); return(Convert.ToInt32(namedDB.ExecuteScalar(sqlCommand))); }
public virtual void InsertList <T>(string cmdInsert , System.Collections.Generic.IEnumerable <T> listToInsert , callbackAddDataClosure_t <T> addDataCallback) { using (System.Data.Common.DbCommand cmd = this.CreateCommand(cmdInsert)) { InsertList <T>(cmd, listToInsert, addDataCallback); } } // End Sub InsertList
static public void Delete(Lookup objLookup) { Database db = DatabaseFactory.CreateDatabase("BKLeadsOnline"); System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand("p_LookupDelete"); db.AddInParameter(dbCommand, "TableName", DbType.String, objLookup.GetType().Name); db.AddInParameter(dbCommand, "ID", DbType.Int32, objLookup.ID); db.ExecuteNonQuery(dbCommand); }
/// <summary> /// 更新 Apq_Tables, Apq_Columns 表内容 /// </summary> /// <param name="DBName">目标数据库名</param> /// <returns>影响行数</returns> public int Refresh(string DBName) { #region 参数检测 if (string.IsNullOrEmpty(DBName)) { throw new ArgumentNullException("DBName"); } #endregion System.Data.Common.DbCommand Command = Connection.CreateCommand(); Apq.Data.Common.DbCommandHelper CommandHelper = new Common.DbCommandHelper(Command); CommandHelper.AddParameter("@Apq_Tables", Apq_Tables); Command.CommandText = "SELECT OBJECT_ID( @Apq_Tables )"; Common.DbConnectionHelper.Open(Connection); #region Apq_Tables if (System.Convert.IsDBNull(Command.ExecuteScalar())) { Command.CommandText = string.Format(Sqls.Apq_TablesCreate, Apq.Data.SqlClient.Common.EncodeString(Apq_Tables), Apq.Data.SqlClient.Common.EncodeString(Apq_Columns), Apq.Data.SqlClient.Common.EncodeString(DBName) ); Command.ExecuteNonQuery(); } Command.CommandText = string.Format(Sqls.Apq_TablesUpdate, Apq.Data.SqlClient.Common.EncodeString(Apq_Tables), Apq.Data.SqlClient.Common.EncodeString(Apq_Columns), Apq.Data.SqlClient.Common.EncodeString(DBName) ); Command.ExecuteNonQuery(); #endregion #region Apq_Columns CommandHelper.AddParameter("@Columns", Apq_Columns); Command.CommandText = "SELECT OBJECT_ID( @Columns )"; if (System.Convert.IsDBNull(Command.ExecuteScalar())) { Command.CommandText = string.Format(Sqls.Apq_ColumnsCreate, Apq.Data.SqlClient.Common.EncodeString(Apq_Tables), Apq.Data.SqlClient.Common.EncodeString(Apq_Columns), Apq.Data.SqlClient.Common.EncodeString(DBName) ); Command.ExecuteNonQuery(); } Command.CommandText = string.Format(Sqls.Apq_ColumnsUpdate, Apq.Data.SqlClient.Common.EncodeString(Apq_Tables), Apq.Data.SqlClient.Common.EncodeString(Apq_Columns), Apq.Data.SqlClient.Common.EncodeString(DBName) ); return(Command.ExecuteNonQuery()); #endregion }
/// <summary> /// Adds the user from catagroy. /// </summary> /// <param name="catId">The cat id.</param> /// <param name="user">The user.</param> public void AddUserFromCatagroy(int catId, string user) { string sqlCommand = "Council_AddUserToThisCatagory"; System.Data.Common.DbCommand dbCommand = this.securityDb.GetStoredProcCommand(sqlCommand); this.securityDb.AddInParameter(dbCommand, "catId", DbType.Int32, catId); this.securityDb.AddInParameter(dbCommand, "user", DbType.String, user); this.securityDb.ExecuteNonQuery(dbCommand); }
} // End Function Sql2DataTableTest public static DataTable Sql2DataTableTest(string SQL, DataTable dt) { using (System.Data.Common.DbCommand cmd = CoinBaseSharp.SQL.CreateCommand(SQL)) { dt = Sql2DataTableTest(cmd, dt); } // End Using cmd System.Console.WriteLine(dt.Rows.Count); return(dt); } // End Function Sql2DataTableTest
/// <summary> /// Executes an update or insert command. /// </summary> /// <param name="command">Command to execute.</param> /// <returns>Number of affected rows.</returns> public int ExecuteCommand(string command) { _logger.WriteVerbose("Executing query: {0}", command); using (System.Data.Common.DbCommand cmd = _connection.CreateCommand()) { cmd.CommandText = command; return(cmd.ExecuteNonQuery()); } }
public static DataSet GetUsersCurrentlyLoggedIn() { DataSet ds; Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "Council_GetUsersCurrentlyLoggedIn"; System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); ds = db.ExecuteDataSet(dbCommand); return(ds); }
public System.Data.Common.DbDataReader ExecuteReader(string sql, System.Data.Common.DbConnection connection) { System.Data.Common.DbDataReader dataReader = null; using (System.Data.Common.DbCommand cmd = this.CreateCommand(sql)) { dataReader = this.ExecuteReader(cmd, connection); } return(dataReader); }
protected void UpdateSKUSendStatusBySKUId(string skuId, string sendStatus) { Database database = DatabaseFactory.CreateDatabase(); System.Data.Common.DbCommand sqlStringCommand = database.GetSqlStringCommand("update Ecshop_Products set IsSendWMS=@sendStatus,SendWMSCount=ISNULL(SendWMSCount,0)+1 WHERE ProductId= (SELECT ProductId FROM dbo.Ecshop_SKUs WHERE SkuId=@skuId ) ;"); database.AddInParameter(sqlStringCommand, "sendStatus", DbType.String, sendStatus); database.AddInParameter(sqlStringCommand, "skuId", DbType.String, skuId); database.ExecuteNonQuery(sqlStringCommand); }
public static IDataReader ExecuteReaderSQLQuery(string SQLQuery) { var startTime = DateTime.Now; System.Data.Common.DbCommand cmd = Db.GetSqlStringCommand(SQLQuery); cmd.CommandTimeout = 0; var result = Db.ExecuteReader(cmd); return(result); }
/// <summary> /// Lista os clientes com os codigos na Gradual e na corretora externa /// </summary> /// <param name="pParametros">Entidade do tipo ClienteDeParaInfo</param> /// <returns>Retorna a lista de clientes</returns> public static Gradual.OMS.Persistencia.ConsultarObjetosResponse <Gradual.Intranet.Contratos.Dados.Relatorios.Cliente.ClienteDeParaInfo> ConsultarClienteDePara(Gradual.Intranet.Servicos.BancoDeDados.Propriedades.Request.ConsultarEntidadeRequest <Gradual.Intranet.Contratos.Dados.Relatorios.Cliente.ClienteDeParaInfo> pParametros) { Gradual.OMS.Persistencia.ConsultarObjetosResponse <Gradual.Intranet.Contratos.Dados.Relatorios.Cliente.ClienteDeParaInfo> lResposta = new Gradual.OMS.Persistencia.ConsultarObjetosResponse <Gradual.Intranet.Contratos.Dados.Relatorios.Cliente.ClienteDeParaInfo>(); ConexaoDbHelper lAcessaDados = new ConexaoDbHelper(); lAcessaDados.ConnectionStringName = gNomeConexao; using (System.Data.Common.DbCommand lDbCommand = lAcessaDados.CreateCommand(System.Data.CommandType.StoredProcedure, "PRC_CLIENTE_DE_PARA_LST")) { if (null != pParametros.Objeto.CodigoGradual && !pParametros.Objeto.CodigoGradual.Equals(0)) { lAcessaDados.AddInParameter(lDbCommand, "CD_CLIENTE_GRADUAL", System.Data.DbType.Int32, pParametros.Objeto.CodigoGradual); } else { lAcessaDados.AddInParameter(lDbCommand, "CD_CLIENTE_GRADUAL", System.Data.DbType.Int32, null); } if (null != pParametros.Objeto.CodigoExterno && !pParametros.Objeto.CodigoExterno.Equals(0)) { lAcessaDados.AddInParameter(lDbCommand, "CD_CLIENTE_EXTERNO", System.Data.DbType.Int32, pParametros.Objeto.CodigoExterno); } else { lAcessaDados.AddInParameter(lDbCommand, "CD_CLIENTE_EXTERNO", System.Data.DbType.Int32, null); } if (null != pParametros.Objeto.CodigoAssessor && !pParametros.Objeto.CodigoAssessor.Equals(0)) { lAcessaDados.AddInParameter(lDbCommand, "CD_CLIENTE_ASSESSOR", System.Data.DbType.String, pParametros.Objeto.CodigoAssessor); } else { lAcessaDados.AddInParameter(lDbCommand, "CD_CLIENTE_ASSESSOR", System.Data.DbType.String, null); } System.Data.DataTable lDataTable = lAcessaDados.ExecuteOracleDataTable(lDbCommand); if (null != lDataTable && lDataTable.Rows.Count > 0) { string[] lAssessores = pParametros.Objeto.CodigoAssessor.Split(','); for (int i = 0; i <= lDataTable.Rows.Count - 1; i++) { if (lAssessores.Contains(lDataTable.Rows[i]["CD_ASSESSOR"].DBToString()) || pParametros.Objeto.CodigoAssessor.Equals(string.Empty)) { lResposta.Resultado.Add(CriarRegistroClienteDeParaInfo(lDataTable.Rows[i])); } } } } return(lResposta); }
private static System.Data.Common.DbCommand GenerateUpdateCommand(string tableName, System.Data.DataRow row) { string idName = GetDefaultIdName(row.Table); StringBuilder prefix = new StringBuilder(); prefix.Append("UPDATE "); prefix.Append(tableName); prefix.Append(" SET "); StringBuilder sb = new StringBuilder(); sb.Remove(0, sb.Length); sb.Append(prefix); System.Data.Common.DbParameter parameter; for (int i = 0; i < row.Table.Columns.Count; ++i) { System.Data.DataColumn column = row.Table.Columns[i]; if (column.ColumnName == idName) { continue; } string s1 = column.ColumnName; string s2 = "@UPDATE" + i.ToString(); sb.Append("[" + s1 + "]" + "= " + s2); sb.Append(","); } sb.Remove(sb.Length - 1, 1); sb.Append(" WHERE " + idName + " = @UPDATE" + idName); System.Data.Common.DbCommand cmd = DbHelper.Instance.Database.GetSqlStringCommand(sb.ToString()); for (int i = 0; i < row.Table.Columns.Count; ++i) { System.Data.DataColumn column = row.Table.Columns[i]; if (column.ColumnName == idName) { continue; } string s1 = column.ColumnName; string s2 = "@UPDATE" + i.ToString(); parameter = DbHelper.Instance.Database.DbProviderFactory.CreateParameter(); parameter.ParameterName = s2; parameter.Value = row[column.ColumnName]; cmd.Parameters.Add(parameter); } parameter = DbHelper.Instance.Database.DbProviderFactory.CreateParameter(); parameter.ParameterName = "@UPDATE" + idName; parameter.Value = row[idName]; cmd.Parameters.Add(parameter); return(cmd); }
} // End Function ExecuteReader_Buggy // WARNING: BUGGY - CONNECTION IS DISPOSED BEFORE IT IS USED internal System.Data.Common.DbDataReader ExecuteReader_Buggy(string sql) { System.Data.Common.DbDataReader dataReader = null; using (System.Data.Common.DbCommand cmd = this.CreateCommand(sql)) { dataReader = this.ExecuteReader_Buggy(cmd); } return(dataReader); } // End Sub ExecuteReader
public object ExecuteScalar(string sql, string connectionString) { object objRetVal = 0; using (System.Data.Common.DbCommand cmd = this.CreateCommand(sql)) { objRetVal = this.ExecuteScalar(cmd, connectionString); } return(objRetVal); }
protected override void Dispose(bool disposing) { if (disposing) { reader?.Dispose(); reader = null; cmd?.Dispose(); cmd = null; } base.Dispose(disposing); }
public bool SQLConnect() { try { string con = System.Configuration.ConfigurationManager.ConnectionStrings["projectdbconnection"].ConnectionString; iCommand = new System.Data.SqlClient.SqlCommand("", new System.Data.SqlClient.SqlConnection(con)); iAdapter = new System.Data.SqlClient.SqlDataAdapter(); iCommand.Connection.Open(); return true; } catch (Exception ex) { return false; } }
/// <summary> /// Add the parameter to the command... internal use only /// </summary> /// <param name="command"></param> /// <param name="name"></param> public void AddParameter(IDbCommand command, string name) { if (IsFixedLength && Length == -1) { throw new InvalidOperationException("If specifying IsFixedLength, a Length must also be specified"); } var param = command.CreateParameter(); param.ParameterName = name; param.Value = SqlMapper.SanitizeParameterValue(Value); if (Length == -1 && Value != null && Value.Length <= DefaultLength) { param.Size = DefaultLength; } else { param.Size = Length; } param.DbType = IsAnsi ? (IsFixedLength ? DbType.AnsiStringFixedLength : DbType.AnsiString) : (IsFixedLength ? DbType.StringFixedLength : DbType.String); command.Parameters.Add(param); }
void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { try { MeasureGroup mg = currentStat.IntermediateMeasureGroup; DataSource oDataSource = mg.Parent.DataSource; DsvTableBinding oTblBinding = new DsvTableBinding(mg.Parent.DataSourceView.ID, MeasureGroupHealthCheckPlugin.GetTableIdForDataItem(mg.Measures[0].Source)); DataTable dtTable = mg.ParentDatabase.DataSourceViews[oTblBinding.DataSourceViewID].Schema.Tables[oTblBinding.TableID]; //check whether this fact table uses an alternate datasource if (dtTable.ExtendedProperties.ContainsKey("DataSourceID")) { oDataSource = mg.ParentDatabase.DataSources[dtTable.ExtendedProperties["DataSourceID"].ToString()]; } Microsoft.DataWarehouse.Design.DataSourceConnection openedDataSourceConnection = Microsoft.DataWarehouse.DataWarehouseUtilities.GetOpenedDataSourceConnection((object)null, oDataSource.ID, oDataSource.Name, oDataSource.ManagedProvider, oDataSource.ConnectionString, oDataSource.Site, false); try { if (openedDataSourceConnection != null) { openedDataSourceConnection.QueryTimeOut = 0; } else { throw new Exception("Couldn't open connection from data source " + oDataSource.Name); } command = openedDataSourceConnection.CreateCommand(); command.CommandText = currentStat.SQL; if (backgroundWorker.CancellationPending) { return; } System.Data.Common.DbDataReader reader = null; try { try { reader = command.ExecuteReader(); } catch (Exception innerEx) { if (backgroundWorker.CancellationPending) { return; } else { throw innerEx; } } if (!backgroundWorker.CancellationPending && reader.Read()) { lock (command) { if (Convert.IsDBNull(reader["OriginalRecordCount"])) currentStat.OriginalRecordCount = null; else currentStat.OriginalRecordCount = Convert.ToInt64(reader["OriginalRecordCount"]); if (Convert.IsDBNull(reader["CompressedRecordCount"])) currentStat.CompressedRecordCount = null; else currentStat.CompressedRecordCount = Convert.ToInt64(reader["CompressedRecordCount"]); if (Convert.IsDBNull(reader["MatrixDimensionRecordCount"])) currentStat.MatrixDimensionRecordCount = null; else currentStat.MatrixDimensionRecordCount = Convert.ToInt64(reader["MatrixDimensionRecordCount"]); currentStat.Status = M2MMatrixCompressionPlugin.M2MMatrixCompressionStat.M2MMatrixCompressionStatStatus.Complete; } foreach (M2MMatrixCompressionPlugin.M2MMatrixCompressionStat stat in _list) { if (stat != currentStat && currentStat.IntermediateMeasureGroupName == stat.IntermediateMeasureGroupName && stat.SQL == currentStat.SQL) { stat.OriginalRecordCount = currentStat.OriginalRecordCount; stat.CompressedRecordCount = currentStat.CompressedRecordCount; stat.MatrixDimensionRecordCount = currentStat.MatrixDimensionRecordCount; stat.Status = M2MMatrixCompressionPlugin.M2MMatrixCompressionStat.M2MMatrixCompressionStatStatus.Complete; } } } } finally { try { if ((reader != null) && !reader.IsClosed) { reader.Close(); } } catch { } command = null; } } finally { try { openedDataSourceConnection.Close(); } catch { } } } catch (Exception ex) { currentStat.Error = ex.Message + "\r\n" + ex.StackTrace; foreach (M2MMatrixCompressionPlugin.M2MMatrixCompressionStat stat in _list) { if (stat != currentStat && currentStat.IntermediateMeasureGroupName == stat.IntermediateMeasureGroupName && stat.SQL == currentStat.SQL) { stat.Error = currentStat.Error; } } } }
public WrappedReader(IDbCommand cmd, IDataReader reader) { this.cmd = cmd; this.reader = reader; }