Why does Crystal Report Viewer always asks for login details to Access database on WePOS operating system?

前端 未结 5 887
遇见更好的自我
遇见更好的自我 2021-02-07 13:16

I wrote a report using Crystal Reports XI linked to an Access database here C:\\MyData.mdb.

The report has one field (simplified for this example) and no sub-reports.

5条回答
  •  清酒与你
    2021-02-07 14:07

    this works for me,

    var rd = new CrystalReport1();
                ConnectionInfo connectionInfo = new ConnectionInfo();
                connectionInfo.DatabaseName = @"d:\testing\test2.mdb";
                connectionInfo.UserID = "admin";
                foreach (Table table in rd.Database.Tables)
                {
                    TableLogOnInfo logonInfo = table.LogOnInfo;
                    logonInfo.ConnectionInfo = connectionInfo;
                    table.ApplyLogOnInfo(logonInfo);                
                }
                crystalReportViewer1.ReportSource = rd;
    

提交回复
热议问题