Hi All,
I am having an issue with loading crystal reports file using serverfilereport web service.
Following are the details:
Crystal Reports version: 10.0.0.533
Visual Studio version: MSVS 2010 Professional
My Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
namespace serverfilereportcall_sample
{
public partial class frmReportLogin : Form
{
private ServerFileReport crServerFileReport;
public frmReportLogin()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
CrystalDecisions.Shared.ServerFileReport serverFileReport = new CrystalDecisions.Shared.ServerFileReport();
serverFileReport.ObjectType = CrystalDecisions.Shared.EnumServerFileType.REPORT;
serverFileReport.ReportPath = txtReport.Text;
serverFileReport.WebServiceUrl = txtWebUrl.Text;
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = txtserver.Text;
connectionInfo.DatabaseName = txtdatabase.Text;
connectionInfo.UserID = txtuser.Text;
connectionInfo.Password = txtpassword.Text;
connectionInfo.AllowCustomConnection = true;
crvReport.ReportSource = serverFileReport;
SetDBLogonForReport(connectionInfo);
crvReport.RefreshReport();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void SetDBLogonForReport(ConnectionInfo connectionInfo)
{
TableLogOnInfos tableLogOnInfos = crvReport.LogOnInfo;
foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
{
tableLogOnInfo.ConnectionInfo = connectionInfo;
}
}
private void crvReport_Error_1(object source, CrystalDecisions.Windows.Forms.ExceptionEventArgs e)
{
try
{
if ((e.Exception) is EngineException)
{
EngineException engEx = null;
engEx = (EngineException)e.Exception;
MessageBox.Show(engEx.InnerException.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
MessageBox.Show(e.Exception.InnerException.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.InnerException.Message);
}
}
}
}
Resulted Exception:
Logon failed.\nDetails: ADO Error Code: 0x\n
Source: Provider
\nDescription: Multiple-step OLE DB operation generated errors.
Check each OLE DB status value, if available. No work was done.
\nNative Error: \rError in File C:\\WINDOWS\\TEMP\\TestReport1 {C752248F-3E57-43AB-BCBF-56E6B5B59E65}.rpt:\n
Unable to connect: incorrect log on parameters."} CrystalDecisions.CrystalReports.Engine.EngineException {CrystalDecisions.CrystalReports.Engine.LogOnException}
Please tell me where I have gone wrong.
How to fix this issue?
Let me have any working sample code if you have.
Appreciate your help !
- Kumara