public static void GetReport(Guid applicationId, ModuleIdentifier moduleIdentifier, string reportName, ref DataTable retReport, ref string retActions, ref Dictionary <string, string> columnsDic, List <ReportParameter> parameters) { retReport.Clear(); retReport.TableName = "Report_" + PublicMethods.get_random_number().ToString(); SqlConnection con = new SqlConnection(ProviderUtil.ConnectionString); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.Parameters.AddWithValue("@ApplicationID", applicationId); string arguments = "@ApplicationID"; foreach (ReportParameter prm in parameters) { _create_parameter(prm, ref cmd, ref arguments); } string spName = GetFullyQualifiedName(reportName, moduleIdentifier); cmd.CommandText = ("EXEC" + " " + spName + " " + arguments); List <Pair> otherTbls = new List <Pair>(); try { con.Open(); IDataReader reader = (IDataReader)cmd.ExecuteReader(); if (ProviderUtil.reader2table(ref reader, ref retReport, false)) { if (reader.NextResult() && reader.Read()) { retActions = (string)reader[0]; } } //Fetch Other Tables while (true) { if (!reader.NextResult()) { break; } DataTable oTbl = new DataTable(); if (!ProviderUtil.reader2table(ref reader, ref oTbl, false)) { break; } string oInfo = reader.NextResult() && reader.Read() ? (string)reader[0] : string.Empty; if (!string.IsNullOrEmpty(oInfo)) { otherTbls.Add(new Pair(oTbl, oInfo)); } } //end of Fetch Other Tables if (!reader.IsClosed) { reader.Close(); reader.Dispose(); } } catch (Exception ex) { LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.RPT); } finally { con.Close(); if (otherTbls.Count > 0) { retReport = _fetch(applicationId, retReport, otherTbls, ref columnsDic); } } }