Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Unknown database connector Crystal Report 13

I have a problem in server computer when I click button to show report(crystal).

The Report is created in Crystal report 9 and i have converted into Crystal Report 13.

And I'm not sure why this issue is happening. While checking the connection it is not connected (TestConnectivity() is always false).

You can see my source code below,

private void ViewCystalReport()

        {

            OracleConnectionStringBuilder builder = new OracleConnectionStringBuilder(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);           

            Tables CrTables;

            string dbDataSource = builder.DataSource;

            string userId = builder.UserID;

            string pass = builder.Password;

            ReportDocument cryRptdocUMENT = new ReportDocument();

            string sRptFolder = Server.MapPath("S36.rpt");

            string path = sRptFolder;

            cryRptdocUMENT.Load(path);

            ConnectionInfo crConnectionInfo = new ConnectionInfo();

            crConnectionInfo.ServerName = builder.DataSource;

            crConnectionInfo.DatabaseName = "Vision";

            crConnectionInfo.UserID = builder.UserID;

            crConnectionInfo.Password = builder.Password;

            CrTables = cryRptdocUMENT.Database.Tables;

            TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();

            crtableLogoninfo.ConnectionInfo = crConnectionInfo;

            int y = 0;

            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)

            {

                crtableLogoninfo = CrTable.LogOnInfo;

                crtableLogoninfo.ConnectionInfo = crConnectionInfo;

                CrTable.TestConnectivity();               

                CrTable.ApplyLogOnInfo(crtableLogoninfo);

                CrTable.LogOnInfo.ConnectionInfo.ServerName = crConnectionInfo.ServerName;

                CrTable.LogOnInfo.ConnectionInfo.DatabaseName = crConnectionInfo.DatabaseName;

                CrTable.LogOnInfo.ConnectionInfo.UserID = crConnectionInfo.UserID;

                CrTable.LogOnInfo.ConnectionInfo.Password = crConnectionInfo.Password;

                CrTable.Location = "dbo." + CrTable.Location;

                y++;

            }

            cryRptdocUMENT.SetDataSource(Ds);

            cryRptdocUMENT.SetDatabaseLogon(builder.UserID, builder.Password, builder.DataSource, "Vision");

            SetDBLogonForReport(connectionInfo);

            if (ParameterArrayList.Count != 0)

            {

                //Getting Value From the Report (Parameter and Formula Feild)

                int ParameterFieldCount = cryRptdocUMENT.DataDefinition.ParameterFields.Count;

                for (int i = 0; i < ParameterFieldCount; i++)

                {

                    string paramname = cryRptdocUMENT.DataDefinition.ParameterFields[i].Name;

                    var myValue = ParameterArrayList.FirstOrDefault(x => x.Key.ToUpper() == paramname.ToUpper());                  

                    cryRptdocUMENT.SetParameterValue(paramname, myValue.Value);

                }

            }

            CrystalReportViewer1.ReportSource = cryRptdocUMENT;

            CrystalReportViewer1.DataBind();

            //Set generated report document as Crystal Report viewer report source           

            cryRptdocUMENT.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, @"D:\\Crystal\\s36.pdf");

        }

Kindly verify the code and update me the information asap.

I'm looking for a work around for 2 day still there is no resolution.

If i'm filling the Dataset it is woking fine but while exporting the Report it is always blank.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question