Hi
I want to passed stored procedure parameters from crystal report to pass those parameter dynamically by arraylist because user will pass parameters by using data driven web pages (can be different reports with different parameter). how can i pass through parameter array lists to crystal report setreportparameters fields.
please check my code;
public void ConfigureReports(ArrayList valuesLists,ArrayList parameterLists)
{
rptReportViewer.RefreshReport();
DataBaseHelper.myReportConnectionInfo = new ConnectionInfo();
DataBaseHelper.defineConnection = null;
DataSet connectionstring = DataBaseHelper.RunSQL("SELECT TOP 1 * FROM SV_MASTER_REPORT WHERE REPORT_ID=" + rdoReportName.SelectedValue.ToString());
DataBaseHelper.myReportConnectionInfo.UserID= connectionstring.Tables[0].Rows[0]["DB_USERID"].ToString();
DataBaseHelper.myReportConnectionInfo.Password = connectionstring.Tables[0].Rows[0]["DB_PASSWORD"].ToString();
DataBaseHelper.myReportConnectionInfo.ServerName = connectionstring.Tables[0].Rows[0]["DB_SERVERNAME"].ToString();
DataBaseHelper.myReportConnectionInfo.DatabaseName = connectionstring.Tables[0].Rows[0]["DB_NAME"].ToString();
reportDouc = new ReportDocument();
string reportPath = "\\"+Server.MapPath(connectionstring.Tables[0].Rows[0]["REPORT_PATH"].ToString());
reportDouc.Load(reportPath);
for (int paracount = 0; valuesLists.Count > paracount; paracount++)
{
reportDouc.SetParameterValue(parameterLists[paracount].ToString(), valuesLists[paracount]);
}
rptReportViewer.ReportSource = reportDouc;
DataBaseHelper.SetDBLogonReport(DataBaseHelper.myReportConnectionInfo, reportDouc);
}
=======================================================
public static void SetDBLogonReport(ConnectionInfo myconnectionInfo, ReportDocument myreportDocument)
{
Tables myTables = myreportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in myTables)
{
TableLogOnInfo myTablelogonInfo = table.LogOnInfo;
myTablelogonInfo.ConnectionInfo = myconnectionInfo;
table.ApplyLogOnInfo(myTablelogonInfo);
}
}
public void ConfigureReports(ArrayList valuesLists,ArrayList parameterLists)
{
rptReportViewer.RefreshReport();
DataBaseHelper.myReportConnectionInfo = new ConnectionInfo();
DataBaseHelper.defineConnection = null;
DataSet connectionstring = DataBaseHelper.RunSQL("SELECT TOP 1 * FROM SV_MASTER_REPORT WHERE REPORT_ID=" + rdoReportName.SelectedValue.ToString());
DataBaseHelper.myReportConnectionInfo.UserID= connectionstring.Tables[0].Rows[0]["DB_USERID"].ToString();
DataBaseHelper.myReportConnectionInfo.Password = connectionstring.Tables[0].Rows[0]["DB_PASSWORD"].ToString();
DataBaseHelper.myReportConnectionInfo.ServerName = connectionstring.Tables[0].Rows[0]["DB_SERVERNAME"].ToString();
DataBaseHelper.myReportConnectionInfo.DatabaseName = connectionstring.Tables[0].Rows[0]["DB_NAME"].ToString();
reportDouc = new ReportDocument();
string reportPath = "\\"+Server.MapPath(connectionstring.Tables[0].Rows[0]["REPORT_PATH"].ToString());
reportDouc.Load(reportPath);
for (int paracount = 0; valuesLists.Count > paracount; paracount++)
{
reportDouc.SetParameterValue(parameterLists[paracount].ToString(), valuesLists[paracount]);
}
rptReportViewer.ReportSource = reportDouc;
DataBaseHelper.SetDBLogonReport(DataBaseHelper.myReportConnectionInfo, reportDouc);
}
=======================================================