private void pv_CargarSqlDataReader(Table tablaReport, int posicion) { try { var queryCommand = string.Empty; #region Llamado de funciones agregadas a reportes. switch (tablaReport.Name) { case "fn_SelCLI_CLIENTE": { queryCommand = "SELECT * FROM ptv.fn_SelCLI_CLIENTE(" + ps_ReportModel.pe_ConfigurationModel.codEmpresa + ",'%')"; break; } case "fn_SelCLI_VENDEDOR": { queryCommand = "SELECT * FROM ptv.fn_SelCLI_VENDEDOR(" + ps_ReportModel.pe_ConfigurationModel.codEmpresa + ",'%')"; break; } } #endregion #region Carga de comando SQL pe_ConnectionReport.CrearComando(queryCommand); #endregion #region Ejecuciòn SQL y carga de funcion en los reportes using (dtTableReport = new DataTable()) { SqlDataReader vResul = pe_ConnectionReport.CargarBD(); dtTableReport.Load(vResul); } try { ps_ReportDocument.Database.Tables[posicion].SetDataSource(dtTableReport); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } catch (Exception ex) { throw ex; } }
private void pv_CargarSqlDataReader(Table tablaReport, int posicion) { try { var queryCommand = string.Empty; #region Llamado de funciones agregadas a reportes. switch (tablaReport.Name) { case "fn_ForRep_Encabezado_Empresa": { queryCommand = "SELECT * FROM [ptv].[fn_ForRep_Encabezado_Empresa](" + ps_FormatModel.pe_empIntCodigo + ")"; break; } case "fn_ForCOM_CLITransacEnc": { queryCommand = "SELECT * FROM [ptv].[fn_ForCOM_CLITransacEnc](" + ps_FormatModel.pe_empIntCodigo + ", '" + ps_FormatModel.pe_traChrNumero + "')"; break; } case "fn_ForCOM_CLITransacDetInv": { queryCommand = "SELECT * FROM [ptv].[fn_ForCOM_CLITransacDetInv](" + ps_FormatModel.pe_empIntCodigo + ", '" + ps_FormatModel.pe_traChrNumero + "')"; break; } } #endregion #region Carga de comando SQL if (!string.IsNullOrEmpty(queryCommand)) { pe_ConnectionFormat.CrearComando(queryCommand); #endregion #region Ejecuciòn SQL y carga de funcion en los reportes using (dtTableFormat = new DataTable()) { SqlDataReader vResul = pe_ConnectionFormat.CargarBD(); dtTableFormat.Load(vResul); } } else { dtTableFormat = null; } try { ps_ReportDocument.Database.Tables[posicion].SetDataSource(dtTableFormat); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } catch (Exception ex) { throw ex; } }