Skip to Content
avatar image
Former Member

C# - Crystal Reports - Set Database and Report Source MDB

So I am trying to change the connection to params for a dynamic crystal report load. Basically making the rpt file a template and it can connect with whatever db location is specified in the app rather than what the developer selected when creating the rpt file. I have tried this but get no success

privatevoidViewReport(string pathToReport){
            crystalReportViewer1.RefreshReport();}privateReportDocumentGetReportSource(string reportPath){ConnectionInfo crConnectionInfo =newConnectionInfo();ReportDocument document =newReportDocument();
            crConnectionInfo.DatabaseName= dirToDB;
            crConnectionInfo.Password="admin";TableLogOnInfos logonInfos =newTableLogOnInfos();TableLogOnInfo logonInfo =newTableLogOnInfo();Tables tables;
            tables = document.Database.Tables;foreach(CrystalDecisions.CrystalReports.Engine.Table table in tables){
                logonInfo = table.LogOnInfo;
                logonInfo.ConnectionInfo= crConnectionInfo;
                table.ApplyLogOnInfo(logonInfo);}return document;}

If I go to Crystal reports. Open the rpt file. Change the Connection details to my mdb file choosing (ole db as the connection protocol) and ONLY type in admin for the password. It connects with out a problem. I open the mdb file in Access. Type admin for password prompt and get let in.

So I guess my question do you have to set the ConnectionType and which parameters are needed for an MDB file that has a password.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers