Click here to Skip to main content
15,910,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i create a report and connect to data base by report wizard and my report open and display data in design but when i run my app and path a param to report error

my code
C#
private void logInfo()
    {
        ReportDocument crystalReport = new ReportDocument();
        //ODBC; Driver=Sybase SQL Anywhere 8.0;Uid=dbo;Pwd=dbo;Dsn=DC;
        crystalReport.Load(Application.StartupPath + "\\" + "v_agl_ledg.rpt");

        //Set DataBase Login Info
        //crystalReport.SetDatabaseLogon("dbo", "dbo", "ODBC; Driver=Sybase SQL Anywhere 8.0;", "DC", true);

        //Provide parameter values
        crystalReport.SetParameterValue("datFrom", Dat_from.Value);//CB_PurOrdSrl.SelectedValue.ToString()
        crystalReport.SetParameterValue("datTo", Dat_To.Value);

        crystalReportViewer1.ReportSource = crystalReport;
        crystalReportViewer1.Visible = true;
    }
Posted
Comments
DamithSL 14-Nov-14 1:45am    
what is exactly the error you get? debug and try what is the value you get for path and check whether your report exist in the given path.
string path = Application.StartupPath + "\\" + "v_agl_ledg.rpt";
crystalReport.Load(path);

Try this ...
public ReportDocument _objReportDocument= new ReportDocument();
_objReportDocument.Load(rptPath);
_objReportDocument.SetDatabaseLogon(DB_UID,Utilities.DB_PWD,DB_SERVER_NAME,DB_NAME));
_objReportDocument.SetParameterValue(paramName, paramVal);//If needed
RptViewer.ReportSource = _objReportDocument;//RptViewer is the CrystalReportViewer control
 
Share this answer
 
my error is Logon failed my database on ODBC DataBase Type Sql AnyWhere8 but when i create my report he connect database is Successfully
My problem
When I run the program show me screen contact for the DataBaseand I am already in contact code written sentences and username and password i need Know Where The error in my code
Plz Help
my Code
C#
ReportDocument crystalReport = new ReportDocument();
            //ODBC; Driver=Sybase SQL Anywhere 8.0;Uid=dbo;Pwd=dbo;Dsn=DC;
            crystalReport.Load(Application.StartupPath + "\\" + "v_agl_assistant_ledger_a.rpt");
 
            //Set DataBase Login Info
            
             crystalReport.SetDatabaseLogon("dbo", "dbo", "ODBC; Driver=Sybase SQL Anywhere 8.0", "DC", true);

             //Provide parameter values
              crystalReport.SetParameterValue("datFrom", Dat_from.Value);//CB_PurOrdSrl.SelectedValue.ToString()
              crystalReport.SetParameterValue("datTo", Dat_To.Value);
 
              crystalReportViewer1.ReportSource = crystalReport;
              crystalReportViewer1.Visible = true;
 
Share this answer
 
Comments
dfernn345 9-Mar-17 19:25pm    
Name server and port??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900