Crystal report shows database login requirement?
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);
ReportD开发者_运维问答ocument 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
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;
}
精彩评论