Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I try to create a crystal report when i debug form it show this

report screen[^]


page load code

protected void Page_Load(object sender, EventArgs e)
       {

           //report code
           DataSet ds = new DataSet();
           Class1 myclass = new Class1();
           ds.Tables.Add(myclass.report1().Copy());
           ds.Tables[0].TableName = "spcustomers";

           CrystalReport1 report = new CrystalReport1();
           report.SetDataSource(ds);
           CrystalReportViewer1.ReportSource = report;
           CrystalReportViewer1.DataBind();}



class code
C#
public class Class1
    {
        Database db = DatabaseFactory.CreateDatabase("NORTHWND");

        public DataTable report1()
        {
            return db.ExecuteDataSet("spcustomers").Tables[0];
        }
    }


any help? how to solve this
Posted
Comments
super_user 21-Jan-16 1:35am    
any help

1 solution

Hi,


I saw the report screen shot above you gave but it is nothing, if you can run the application it will ask every time database login credentials database name, user name and password. we can easily solve asking login credentials. if you can use the below code

ReportDocument reportDocument= new ReportDocument();

reportDocument.Load(Server.MapPath("Reports\\CustomerReport.rpt"));

reportDocument.SetDatabaseLogon(db username, db password, db server, database name);

CrystalReportViewer1.ReportSource = reportDocument;


if you need any help ping me
 
Share this answer
 

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