suicidaltendencies
Programmer
I keep getting the following error:
Logon failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
Source Error:
Line 95: myExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
Line 96: myExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
Line 97:
Line 98: report.Export();
Line 99:
HERE IS MY CODE:
private void Page_Load(object sender, System.EventArgs e)
{
report = new MainProject.Reporting.crcustomerreport();
// Create connection
SqlConnection objConn = new SqlConnection(ConfigurationSettings.AppSettings"ConnectionString"
SqlCommand myCommand = new SqlCommand("getCustomersNoOwnerIDReturned", objConn);
myCommand.CommandType = CommandType.StoredProcedure;
SqlParameter parameterOwnerID2 = new SqlParameter("@OwnerID", SqlDbType.VarChar, 50);
parameterOwnerID2.Value = (string)Session"OwnersUserName";
myCommand.Parameters.Add(parameterOwnerID2);
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
MainProject.Reporting.dscustomerreport ds = new MainProject.Reporting.dscustomerreport();
myAdapter.Fill(ds, "Customers"
report.SetDataSource(ds);
CrystalReportViewer1.DisplayGroupTree = false;
CrystalReportViewer1.DisplayToolbar = false;
CrystalReportViewer1.ReportSource= report;
}
private void btnExport_Click(object sender, System.EventArgs e)
{
ExportOptions myExportOptions;
DiskFileDestinationOptions myDiskFileDestinationOptions;
string myExportFile;
report = new MainProject.Reporting.crcustomerreport();
myExportFile = @"C:\temp\" + Session.SessionID.ToString() + ".pdf";
myDiskFileDestinationOptions = new DiskFileDestinationOptions();
myDiskFileDestinationOptions.DiskFileName = myExportFile;
myExportOptions = report.ExportOptions;
myExportOptions.DestinationOptions = myDiskFileDestinationOptions;
myExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
myExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
report.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(myExportFile);
Response.Flush();
Response.Close();
System.IO.File.Delete(myExportFile);
}
Can anyone tell me what I need to do to fix this problem. I'll need details, I'm new to Crystal Reports .NET.
Thanks,
Harold
Logon failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
Source Error:
Line 95: myExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
Line 96: myExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
Line 97:
Line 98: report.Export();
Line 99:
HERE IS MY CODE:
private void Page_Load(object sender, System.EventArgs e)
{
report = new MainProject.Reporting.crcustomerreport();
// Create connection
SqlConnection objConn = new SqlConnection(ConfigurationSettings.AppSettings"ConnectionString"
SqlCommand myCommand = new SqlCommand("getCustomersNoOwnerIDReturned", objConn);
myCommand.CommandType = CommandType.StoredProcedure;
SqlParameter parameterOwnerID2 = new SqlParameter("@OwnerID", SqlDbType.VarChar, 50);
parameterOwnerID2.Value = (string)Session"OwnersUserName";
myCommand.Parameters.Add(parameterOwnerID2);
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
MainProject.Reporting.dscustomerreport ds = new MainProject.Reporting.dscustomerreport();
myAdapter.Fill(ds, "Customers"
report.SetDataSource(ds);
CrystalReportViewer1.DisplayGroupTree = false;
CrystalReportViewer1.DisplayToolbar = false;
CrystalReportViewer1.ReportSource= report;
}
private void btnExport_Click(object sender, System.EventArgs e)
{
ExportOptions myExportOptions;
DiskFileDestinationOptions myDiskFileDestinationOptions;
string myExportFile;
report = new MainProject.Reporting.crcustomerreport();
myExportFile = @"C:\temp\" + Session.SessionID.ToString() + ".pdf";
myDiskFileDestinationOptions = new DiskFileDestinationOptions();
myDiskFileDestinationOptions.DiskFileName = myExportFile;
myExportOptions = report.ExportOptions;
myExportOptions.DestinationOptions = myDiskFileDestinationOptions;
myExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
myExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
report.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(myExportFile);
Response.Flush();
Response.Close();
System.IO.File.Delete(myExportFile);
}
Can anyone tell me what I need to do to fix this problem. I'll need details, I'm new to Crystal Reports .NET.
Thanks,
Harold