I have a report made with Crystal Reports 2008 that I need to deploy a production system which means that I need to be able to change the database connection at runtime. Th
First of all thank you for this information!!!
I'm using MySQL/C#/Crystal Reports. After setting up the ODBC/DSN something as simple as this worked for me.
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using MySql.Data.MySqlClient;
.
.
.
ConnectionInfo connInfo = new ConnectionInfo();
connInfo.ServerName = "Driver={MySQL ODBC 3.51 Driver};DSN=MyODBCDatasourceName";
TableLogOnInfo tableLogOnInfo = new TableLogOnInfo();
tableLogOnInfo.ConnectionInfo = connInfo;
// rpt is my Crystal Reports ReportDocument
// Apply the schema name to the table's location
foreach (Table table in rpt.Database.Tables)
{
table.ApplyLogOnInfo(tableLogOnInfo);
table.Location = table.Location;
}