Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2878

Re: Crystal reports - Microsoft Access - 64bit OS

$
0
0

Hi Marko,

 

CR only supports the 64 bit Access using ODBC or OLE DB only, JET or ACE is not supported.

 

Also, to get the 64 bit driver you need to install the 64 bit client which you can download from Microsoft.

MS does not allow having both the 32 and 64 bit ODBC/OLE DB Access drivers installed on the SAME PC.

 

Once you have that configured this works:

 

//Create a new Database Table to replace the reports current table.

CrystalDecisions.ReportAppServer.DataDefModel.Table boTable = new CrystalDecisions.ReportAppServer.DataDefModel.Table();

CrystalDecisions.ReportAppServer.DataDefModel.Table subboTable = new CrystalDecisions.ReportAppServer.DataDefModel.Table();

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo newConnInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo oldConnInfo;

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfos oldConnInfos;

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();

 

//Get the Database Tables Collection for your report

CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables;

boTables = rptClientDoc.DatabaseController.Database.Tables;

 

// Get the old connection info

oldConnInfos = rptClientDoc.DatabaseController.GetConnectionInfos(null);

boTable.ConnectionInfo = boConnectionInfo;

 

oldConnInfo = oldConnInfos[0];

 

# region DAO Access

if (oldConnInfo.Attributes["Database DLL"].ToString() == "crdb_dao.dll")

{

    // Engine

    CrystalDecisions.CrystalReports.Engine.ReportObjects crReportObjects;

    CrystalDecisions.CrystalReports.Engine.SubreportObject crSubreportObject;

    CrystalDecisions.CrystalReports.Engine.ReportDocument crSubreportDocument;

    CrystalDecisions.CrystalReports.Engine.Database crDatabase;

    CrystalDecisions.CrystalReports.Engine.Tables crTables;

 

    CrystalDecisions.Shared.TableLogOnInfo tLogonInfo;

 

    btnSQLStatement.Text = "";

 

    try

    {

        foreach (CrystalDecisions.CrystalReports.Engine.Table rptTable in rpt.Database.Tables)

        {

            tLogonInfo = rptTable.LogOnInfo;

            tLogonInfo.ConnectionInfo.ServerName = @"D:\Atest\482607\Latest\dsTimesheet.xml";

            tLogonInfo.ConnectionInfo.DatabaseName = newDataFile; // D:\Atest\199019\ot_tmp88.mdb

            tLogonInfo.ConnectionInfo.UserID = "";

            tLogonInfo.ConnectionInfo.Password = "";

            tLogonInfo.TableName = rptTable.Name;

 

            dtStart = DateTime.Now;

 

            try

            {

                rptTable.ApplyLogOnInfo(tLogonInfo);

            }

            catch (Exception ex)

            {

                MessageBox.Show("ERROR: " + ex.Message);

                //return;

            }

 

            difference = DateTime.Now.Subtract(dtStart);

 

            //rptTable.Location = rptTable.Name;

            btnSQLStatement.Text += /*rptTable.Name.ToString() +*/ " Set in " + difference.Minutes.ToString() + ":" + difference.Seconds.ToString() + ":" + difference.Milliseconds.ToString() + "\n";

 

        }

    }

    catch (Exception ex)

    {

        MessageBox.Show("ERROR: " + ex.Message);

        //return;

    }

 

    // check for subreports

...

 

Note you need to use RAS to get the old connection info.

 

Don


Viewing all articles
Browse latest Browse all 2878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>