Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8381231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:39:03+00:00 2026-06-09T16:39:03+00:00

I am using Crystal report that comes with visual studio 2008, mvc 2. i

  • 0

I am using Crystal report that comes with visual studio 2008, mvc 2.
i want when user clicks on the link the PDF report is generated.

this is my method to configure crystal report

    public ReportClass ConfigureReportClass(string strReportPath, object[] objParameters)
    {
        ReportClass rptH = new ReportClass();
        try
        {
                rptH = new ReportClass();
                rptH.FileName = strReportPath;
                int Count = 0;
                rptH.Load();
                if (objParameters == null)
                    return rptH;
                foreach (object obj in objParameters)
                {
                    ParameterField param = rptH.ParameterFields[Count++];  // first param 
                    param.AllowCustomValues = true;
                    ParameterDiscreteValue Disparam = new ParameterDiscreteValue();
                    Disparam.Value = obj;
                    param.CurrentValues.Add(Disparam);
                }

        }
        catch (Exception ex)
        {
            throw ex;
        }
        return rptH;
    }

and this one to convert it in to PDF

        public System.IO.Stream GetPDFStream(CrystalDecisions.CrystalReports.Engine.ReportClass rptClass)
    {
        System.IO.Stream stream = rptClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        return stream;
    }

and this one is my action method in controller

        public FileResult GetComplaintFile(String ComplaintNumber)
    {
        HomeBLLC objHomeBLLC = new HomeBLLC();
        ReportClass rptH = objHomeBLLC .ConfigureReportClass(Server.MapPath("~/Views/Complaint/ComplaintReport.rpt"), new object[] { ComplaintNumber });
        return File( objHomeBLLC.GetPDFStream(rptH),"application/pdf" );
    }

i can see preview of my report in design view in visual studio but get the exception at runtime

 Logon failed.

Details: 28000:[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ‘user’.
Error in File C:\Windows\TEMP\ComplaintReport {5BDD522D-04DA-48CD-9F43-A9C648F195D9}.rpt:
Unable to connect: incorrect log on parameters. at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType)
at myapp.BLL.Home.HomeBLLC.GetPDFStream(ReportClass rptClass) in F:\myapp\BLL\Home\HomeBLLC.CS:line 1082

at myapp.Controllers.ComplaintController.GetComplaintFile(String ComplaintNumber) in F:\myapp\Controllers\ComplaintController.cs:line 709
at myapp.Controllers.ComplaintController.Complaint() in F:\myapp\Controllers\ComplaintController.cs:line 76
at lambda_method(ExecutionScope , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c_DisplayClassd.b_a()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassd.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList
1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)

my DSN is correctly configured because other application which is using same DSN is running the Crystal report correctly.

thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:39:05+00:00Added an answer on June 9, 2026 at 4:39 pm

    i missed the basic thing, after studying the related questions i came to know that i forgot to give the authentication in my configure crystal report method which is necessary
    my modified Method is as follows

        public ReportClass ConfigureReportClass(string strReportPath, object[] objParameters)
        {
            ReportClass rptH = new ReportClass();
            rptH.FileName = strReportPath;
            int Count = 0;
            rptH.Load();
            rptH.SetDatabaseLogon("myusername", "mypassword");
            try
            {
                if (objParameters == null)
                    return rptH;
                foreach (object obj in objParameters)
                {
                    ParameterField param = rptH.ParameterFields[Count++];  // first param 
                    param.AllowCustomValues = true;
                    ParameterDiscreteValue Disparam = new ParameterDiscreteValue();
                    Disparam.Value = obj;
                    param.CurrentValues.Add(Disparam);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return rptH;
        }
    

    the Only thing i added is rptH.SetDatabaseLogon(“myusername”, “mypassword”);
    to my code and its working.
    no idea why i have to give the authentication again because i already gave authentication in my DSN. any Suggestions are Welcome.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using crystal reports (the version that comes with visual studio 2008) to
I'm using Crystal Report with VB.NET in Visual Studio 2005. I have report that
I am using Visual Studio 2008(vb.net), SQL Server 2008 and Crystal Report 9. I
I am using Visual Studio 2008 and all the components that come with it
I have a Crystal Report created in Visual Studio 2008 which displays various stock
I am using Crystal Reports inside Visual Studio 2005. I have created a report
I have a C# 2010 application that contains a report created using Crystal Reports
Using Crystal report 7 I want to view the table 1 and sum of
Using Crystal Report 8.5 How to skip blank pages? I want to skip blank
Often I'm creating reports in Visual Studio's Crystal Reports and want to have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.