I am facing problem with crystal reprot when i run that report on to the other machine and the database source is not the same as the machine where the reprots where created. It gives a logon Failed Message.
I tried the following code as well but still it give the same problem.
Can anybody help me.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace CrystalReport_Change_connection
{
public partial class Form1 : Form
{
CrystalReport1 rpt = new CrystalReport1();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string path1 = Application.StartupPath+"test.mdb";
try
{
rpt.DataSourceConnections[0].SetConnection(path1, path1, false);
crystalReportViewer1.ReportSource = rpt;
}
catch(CrystalDecisions.ReportSource.EnterpriseLogonException exp)
{
MessageBox.Show(exp.Message);
}
}
}
}