Crystal Report Login fail for access

蹲街弑〆低调 提交于 2019-12-24 07:27:26

问题


PROBLEM: I see login Info window when loading report.

Tried alot. Read many forums but no success. Below is the code. I am using latest Crystal Report in VS2010. Windows forms.

I am using access db 2010 with password only. I am not sure what to use username and I never mentioned in access. My CrystalReportViewer is attached to DataSet which is ReportingDS.xsd .

Please help.

private static string StrCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.ExecutablePath.ToString().Substring(0, Application.ExecutablePath.ToString().LastIndexOf('\\')) + "\\Reporting.accdb;Jet OLEDB:Database Password=abc;";
        public Report_Frm()
        {
            InitializeComponent();
        }

        private void Report_Frm_Load(object sender, EventArgs e)
        {

            ReportDocument cryRpt = new ReportDocument();

            cryRpt.Load(@"C:\Users\chris\Documents\Visual Studio 2010\Projects\ReportingSystem\ReportingSystem\myReport.rpt");

            cryRpt.SetDatabaseLogon("Admin", "abc", @"C:\Users\chris\Documents\Visual Studio 2010\Projects\ReportingSystem\ReportingSystem\ReportingDS", "Reporting.accdb");

            crystalReportViewer.ReportSource = cryRpt;
            //crystalReportViewer.Refresh();



            }

回答1:


The code worked for me without database prompting:

Dim reportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument

'load report
reportDocument.Load("C:\Documents and Settings\Administrator\Desktop\customer.rpt")

'set user-id/password
reportDocument.SetDatabaseLogon("Admin", "abc")

'bind to viewer
Me.CrystalReportViewer1.ReportSource = reportDocument

The report uses an Access database connected via OLEDB.



来源:https://stackoverflow.com/questions/7381062/crystal-report-login-fail-for-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!