locked
Error Opening CrystalReportViewer on the Webserver RRS feed

  • Question

  • User1556928295 posted

    When I try to open my CrystalReport on the Webserver I get this error;

    Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. SQL State: 08001 Native Error: Error in File C:\Windows\TEMP\cryVls1a33 {982C3F01-7159-47A6-B65C-771961E1F48A}.rpt: Unable to connect: incorrect log on parameters.

    I set the connection string in the report and if got the connection info correct;

            Dim ConnInfo As New ConnectionInfo

            With ConnInfo
                .ServerName = "##.###.##.#"
                .DatabaseName = "***"
                .UserID = "**********"
                .Password = "********"
            End With

    Why does it work on my local host, but not on the Webserver?

    Tuesday, April 29, 2014 1:05 PM

Answers

  • User1556928295 posted

    I went another way with this and just added a button to extract the CrystalReport to a PDF file Instead of letting the Viewer handle it. Sometimes things done by hand are better than a package deal.

    Here is my code:

    Dim cmd As New SqlCommand("sp_Report_BoardMeeting_Snapshot", con)

    Dim DateSelected As String = lbBoardMeetingDates.SelectedItem.Text

    cmd.CommandType = CommandType.StoredProcedure

    cmd.Parameters.AddWithValue(

    "@BoardMeeting_Dt", DateSelected)

    Dim da As New SqlDataAdapter()

    da.SelectCommand = cmd

    Dim datatable As New DataTable()

    da.Fill(datatable)

    ' getting value according to imageID and fill dataset

    Dim crystalReport As New ReportDocument()

    ' creating object of crystal report

    crystalReport.Load(Server.MapPath(

    "~\Reports\cryVls1a34.rpt"))

    ' path of report

    crystalReport.SetDataSource(datatable)

    crystalReport.SetParameterValue(

    "@Heading", "Licensees approved at " & DateSelected & " Board Meeting")

    ' binding datatable

    CrystalReportViewer1.ReportSource = crystalReport

    crystalReport.ExportToHttpResponse(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat, Response,

    True, "cryVls1a34")

    'here i have use [ CrystalDecisions.Shared.ExportFormatType.PortableDocFormat ] to Export in PDF

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 13, 2014 3:35 PM

All replies

  • User364480375 posted

    you can solve this problem by installing SQL Native Client drivers (sqlncli.msi) in your server. You can download it from here 

    Sqlncli.msi After install sqlncli.msi component in server run your application it will work for you. 

    Tuesday, April 29, 2014 1:26 PM
  • User1556928295 posted

    We've got the drivers installed. Otherwise I wouldn't get my gridview working.

    Tuesday, April 29, 2014 2:10 PM
  • User1243880387 posted

    This is not the problem with the Crystal Report, the problem lies with the connection to the server. Please check the configuration settings in the web config.

    Also if you have been given the rights to access database etc.

    If any file needs to be downloaded. This can give you some direction.

    Tuesday, May 6, 2014 12:47 AM
  • User1556928295 posted

    Can you give me a sample web.config file to compare mine with?

    Tuesday, May 6, 2014 9:35 AM
  • User1556928295 posted

    I went another way with this and just added a button to extract the CrystalReport to a PDF file Instead of letting the Viewer handle it. Sometimes things done by hand are better than a package deal.

    Here is my code:

    Dim cmd As New SqlCommand("sp_Report_BoardMeeting_Snapshot", con)

    Dim DateSelected As String = lbBoardMeetingDates.SelectedItem.Text

    cmd.CommandType = CommandType.StoredProcedure

    cmd.Parameters.AddWithValue(

    "@BoardMeeting_Dt", DateSelected)

    Dim da As New SqlDataAdapter()

    da.SelectCommand = cmd

    Dim datatable As New DataTable()

    da.Fill(datatable)

    ' getting value according to imageID and fill dataset

    Dim crystalReport As New ReportDocument()

    ' creating object of crystal report

    crystalReport.Load(Server.MapPath(

    "~\Reports\cryVls1a34.rpt"))

    ' path of report

    crystalReport.SetDataSource(datatable)

    crystalReport.SetParameterValue(

    "@Heading", "Licensees approved at " & DateSelected & " Board Meeting")

    ' binding datatable

    CrystalReportViewer1.ReportSource = crystalReport

    crystalReport.ExportToHttpResponse(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat, Response,

    True, "cryVls1a34")

    'here i have use [ CrystalDecisions.Shared.ExportFormatType.PortableDocFormat ] to Export in PDF

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 13, 2014 3:35 PM