/// <summary> /// Executes the report query. /// </summary> /// <param name="structure">The structure.</param> /// <param name="parameters">The parameters.</param> /// <returns></returns> internal override DbDataAdapter ExecuteReportQuery(DbSqlStructure structure, List <DbInputParameter> parameters) { try { if (Connection.State != ConnectionState.Open) { Connection.Open(); } DbCommand command = Connection.CreateCommand(); command.CommandText = structure.Sql; command.CommandType = structure.SqlType; command.CommandTimeout = 0; ClientHelper.AttachParameters(command, parameters); DbDataAdapter dataAdapter = Factory.CreateDataAdapter(); dataAdapter.SelectCommand = command; return(dataAdapter); } catch { throw; } finally { if (Connection != null) { Connection.Close(); } } }
/// <summary> /// Executes the disconnected. /// </summary> /// <param name="structure">The structure.</param> /// <param name="parameters">The parameters.</param> /// <returns></returns> internal override DataTable ExecuteDisconnected(DbSqlStructure structure, List <DbInputParameter> parameters) { DbDataAdapter dbDataAdapter = (DbDataAdapter)null; DataTable dataTable = new DataTable(); try { if (Connection.State != ConnectionState.Open) { Connection.Open(); } DbCommand command = this.Connection.CreateCommand(); command.CommandText = structure.Sql; command.CommandType = structure.SqlType; command.CommandTimeout = 0; ClientHelper.AttachParameters(command, parameters); dbDataAdapter = this.Factory.CreateDataAdapter(); dbDataAdapter.SelectCommand = command; dbDataAdapter.Fill(dataTable); return(dataTable); } catch { throw; } finally { if (dbDataAdapter != null) { dbDataAdapter.Dispose(); } if (Connection != null) { Connection.Close(); } } }