Marvin kakuru

Marvin kakuru

  • 1.4k
  • 354
  • 159.7k

crystalreports failing to logon access database 2007 - 2016

Sep 23 2021 10:35 AM

Hello members,

am having a problem with my crystalreports failing to logon on to my access database. I have removed the password of the database but crystal reports is still failing to log onto my database

//below is the code am using to load my crystal report

            SerialPrintreport cr = new SerialPrintreport();
            TextObject T1 = (TextObject)cr.ReportDefinition.Sections["Section1"].ReportObjects["Text1"];
            T1.Text = sn1.Text;
            TextObject T2 = (TextObject)cr.ReportDefinition.Sections["Section1"].ReportObjects["Text2"];
            T2.Text = sn2.Text;

            string databasePath = Application.StartupPath + "\\serialprint.accdb";

            cr.DataSourceConnections[0].SetConnection("MS Access Database", databasePath, "admin", "");


            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;
            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = "1";
            crParameterFieldDefinitions = cr.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["imageno"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            SerialPrintreport.ReportSource = cr;

//

crystalreports requests for a password and fails to log onto access database

 


Answers (2)