Cannot get crystal report to show in viewer in web application
I am having problems getting my crystal reports to show in the crystal report viewer. Using an Oracle database, I created datasets for each report. I created a crystal report with an ADO.NET connection using the dataset. The problem I am having is with the c# code. I have tried several things from researching the internet and nothing has worked so far. The report has start & end date parameters to be entered by the user. I included these parameters in the SQL statement in the dataset. I have created 2 textboxes and a button to display the report. The error message that I am getting is "ORA-00900: invalid SQL statement."
Here is my latest code:public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
{
string strConn = ConfigurationManager.ConnectionString.["FCDC1ConnectionString"].ConnectionString;
OleDbConnection oledbConn = new OleDbConnection(strConn);
OleDbCommand oledbCmd;
oledbCmd = new OleDbCommand();
oledbCmd.Connection = oledbConn;
oledbCmd.CommandType = CommandType.Text;
OleDbDataAdapter oledbAd = new OleDbDataAdapter();
oledbAd.SelectCommand = oledbCmd;
DataSet ds = new LetterSummary();
oledbAd.Fill(ds, "LetterSummaryDT");
ReportDocument myReportDocument;
myReportDocument = new ReportDocument();
myReportDocument.Load(Server.MapPath("LetterSummaryReport.rpt"));
myReportDocument.SetDataSource(ds);
CrystalReportViewer1.ReportSource = myReportDocument;
CrystalReportViewer1.DataBind();
var parameterFieldDefinitions = myReportDocument.DataDefinition.ParameterFields;
var startDateParameter = parameterFieldDefinitions["sDate"];
var endDateParameter = parameterFieldDefinitions["eDate"];var parameterValues = startDateParameter.CurrentValues;
var parameterValues2 = endDateParameter.CurrentValues;
var discretestartDate = new ParameterDiscreteValue { Value = txtStartDate.Text };
var discreteendDate = new ParameterDiscreteValue { Value = txtEndDate.Text };
parameterValues.Add(discretestartDate);
parameterValues2.Add(discreteendDate);
startDateParameter.ApplyCurrentValues(parameterValues);
endDateParameter.ApplyCurrentValues(parameterValues2);The DataSet SQL is:
SELECT FC_CASE_PROCESS.PROCESS_TYPE, FC_CASE.COURT_FEE, FC_CASE.COURT_FINE, FC_PAYMENT.AMOUNT, FC_PAYMENT.PAY_DATE, FC_PAY_PLAN.DUE_AMOUNT, FC_CASE_PROCESS.CASE_NO, FC_LKP_PROCESS_1.PROCESS_DESC
FROM FC_CASE
INNER JOIN FC_CASE_PROCESS ON FC_CASE.CASE_NO = FC_CASE_PROCESS.CASE_NO
INNER JOIN FC_PAYMENT ON FC_CASE.CASE_NO = FC_PAYMENT.CASE_NO
INNER JOIN FC_PAY_PLAN ON FC_CASE.CASE_NO = FC_PAY_PLAN.CASE_NO
INNER JOIN FC_LKP_PROCESS ON FC_CASE_PROCESS.PROCESS_CODEFC_LKP_PROCESS.PROCESS_CODE
INNER JOIN FC_LKP_PROCESS FC_LKP_PROCESS_1 ON FC_CASE_PROCESS.PROCESS_CODE = FC_LKP_PROCESS_1.PROCESS_CODE
WHERE (FC_PAYMENT.PAY_DATE >= :SDATE) AND (FC_PAYMENT.PAY_DATE <= :EDATE)
I get around 5000 records when I run the SQL. Please help!- Moved byHarry ZhuMSFTMonday, November 09, 2009 3:48 AM (From:Crystal Reports for Visual Studio)
Answers
- Hi,
It appears the question is relating to oracle database, you will get better response from oracle forum.
Please also make sure the dataset is typed, please take a look at the tutorial about how to connect to dataset:
http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crtsktutorialsdatads.htm
Harry
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byCFain Wednesday, November 11, 2009 5:36 AM
All Replies
- Hi,
It appears the question is relating to oracle database, you will get better response from oracle forum.
Please also make sure the dataset is typed, please take a look at the tutorial about how to connect to dataset:
http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crtsktutorialsdatads.htm
Harry
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byCFain Wednesday, November 11, 2009 5:36 AM


