.net C# crystal reports filtering records
I have a webform1.aspx in which I get employee ID and permissions. I store both values in Session variables. Then I call another webform2.aspx with crystalReportViewer. This consists of a OracleReport1.rpt that has several columns from two different tables: empTbl and permissionsTbl, joined via empid
I created the report by draggin-n-dropping empname and empid from empTbl
and permissions from permissionsTbl, into the OracleReport1.rpt
This works fine as it is.
However, in my webform2.apsx I want to filter the records based on the empid received from the previous webform1.aspx page.
Here is my code in webform2.apsx to do that:
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
OracleReport1 crReportDocument = new OracleReport1();
TableLogOnInfo crTableLogOnInfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
protected CrystalDecisions.CrystalReports.Engine.Database crDatabase;
protected CrystalDecisions.CrystalReports.Engine.Tables crTables;
private void Page_Load(object sender, System.EventArgs e)
{
string empid, perm;
empid = (string)Session["empid"];
perm = (string)Session["perm"];
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;
No I am completely lost :
Based on the empid, I want to retrieve and display only those rows that match the empid.
How can I Create a sql statement and pass it to ParameterFields ?? to get the filtered values
OR
Write a stored procedure - if so, how to call the stored procedure and pass the values returned from stored procedure to the OracleReport1.rpt?
}
I will really appreciate your help.
|