Skip to Content
author's profile photo Former Member
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.ReportSource=GetReportSource(pathToReport);
            crystalReportViewer1.RefreshReport();}privateReportDocumentGetReportSource(string reportPath){ConnectionInfo crConnectionInfo =newConnectionInfo();ReportDocument document =newReportDocument();
            document.Load(reportPath); 
            crConnectionInfo.DatabaseName= dirToDB;
            crConnectionInfo.UserID="Admin";
            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 a comment
10|10000 characters needed characters exceeded

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.