views:

84

answers:

1

Hello All, I have created a crystal report using MySql 5.1, using XML (Dataset save as xml in application root folder) now when i run on my machine it works fine. But when app is installed on other machine it give database login required. how can i remove that login window ? The code is given below

    cDataSet.DataSetName = "TimeDataSet";  
    cDataSet.WriteXml(Application.StartupPath
    + "\\" + "TimeDSReport.xml", XmlWriteMode.WriteSchema); 
    ReportDocument report = new ReportDocument();   
    report.Load(Application.StartupPath + "\\" + "TimeTracker.rpt");         
    crystalReportViewer1.ReportSource = report;

Please see if the code is fine or i need to add some additional parameter?

Thanks PAL

A: 

Make sure that the Name or the DataTable in "Typed DataSet" and the Name DataTable that you assign as "RecordSource" to crystal reprort must be same

Or if u are using directly from database Set the logon information in your code as below

private void ConfigureCrystalReports()
{
    rpt= new ReportDocument();
    string reportPath = Server.MapPath("reportname.rpt");
    rpt.Load(reportPath);
    ConnectionInfo connectionInfo = new ConnectionInfo();
    connectionInfo.DatabaseName = "Northwind";
    connectionInfo.UserID = "sa";
    connectionInfo.Password="pwd";
    SetDBLogonForReport(connectionInfo,rpt);
    CrystalReportViewer1.ReportSource = rpt;
}
renjucool
Hi. I have tried this on my system, it work perfect. on installing it to new system it gave similar error. So i have founded a perfect alternative for it. //Just setting this property, it worked fine.report.SetDataSource(cDataSet);thanks for your advice. :-D
A.P.S