Print Page | Close Window

Connection to local .mdb using CR 10.5 x64 runtime

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=10747
Printed Date: 30 Apr 2024 at 10:59am


Topic: Connection to local .mdb using CR 10.5 x64 runtime
Posted By: davidkouts
Subject: Connection to local .mdb using CR 10.5 x64 runtime
Date Posted: 05 Aug 2010 at 5:32am
Hi,

I am using the CR 10.5 x86 and x64 runtimes for an application built in VS 2008. The application builds and runs correctly, and I am able to load and view a .rpt using an .mdb as the datasource.



In the x86 version of the application:

I use the CR 10.5 x86 runtimes, and the .rpt file was built using a DAO connection to an .mdb. I apply the following code to dynamically change the datasource:

public bool ChangeDatasource(string DatabasePath) // E.g. DatabasePath = "C:\newdata.mdb"
{
crConnectionInfo.ServerName = DatabasePath;
crConnectionInfo.DatabaseName = DatabasePath;
crConnectionInfo.UserID = "";
crConnectionInfo.Password = "password";
//Loop through all tables in the main report
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;
for (int i = 0; i < crTables.Count; i++)
{
crTable = crTables http://forums.sdn.sap.com/ - i ;
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.TableName = crTable.Name;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
bool bOn = crTable.TestConnectivity();
if (!bOn)
MessageBox.Show("Failed to connect to " + crTable.Name);
}
crReportDocument.VerifyDatabase();
}

The above works perfectly in x86.



However, in the x64 version:

Using the CR 10.5 x64 runtimes, the application builds and runs correctly, and displays a simple report just fine.

However, when I use the code above, TestConnectivity() fails and I get the following error during VerifyDatabase():
"Error in File ____.rpt: Invalid mapping type value."

As I understand it, this is because the .rpt was built with a DAO connection, which does not support 64-bit. Thus, I am trying to alter the .rpt to use another connection. My results are as follows:

32-bit DSN, using DAO / ODBC / ADO: I can create the connection, but I still get the "Invalid mapping type value" error when running the code above in x64.

64-bit DSN using ODBC: I get an IM014 "The specified DSN contains an architecture mismatch" error in the Database Expert when trying to set up the connection.

64-bit DSN using ADO: None of the provider options seem to work when setting up the connection in the Database Expert. I get errors like "Data source name not found and no default driver specified".

Note, before anyone asks: Yes, I do have the 64-bit Access ODBC drivers installed, and working. I use them in another part of my x64 application, and they work correctly.



Any help would be GREATLY appreciated.



Print Page | Close Window