Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 18th, 2007, 07:53 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 121
Thanks: 1
Thanked 0 Times in 0 Posts
Default Unable to connect: incorrect log on parameters.

Hello Experts,
I am having big ptoblems to connect my Crystal Report to MS Access database from inside my ASP.NET application. I did not have any problems to connect to ORACLE, but now I am getting this error:


Error in File c:\inetpub\wwwroot\HABReports\Reports\HABReportWho leTest.rpt: Unable to connect: incorrect log on parameters.
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.LogOnExcept ion: Error in File c:\inetpub\wwwroot\HABReports\Reports\HABReportWho leTest.rpt: Unable to connect: incorrect log on parameters.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[LogOnException: Error in File c:\inetpub\wwwroot\HABReports\Reports\HABReportWho leTest.rpt:
Unable to connect: incorrect log on parameters.]
   .L(String , EngineExceptionErrorID )
   .G(Int16 
, Int32 )
   .F(Int16  )
   CrystalDecisions.CrystalReports.Engine.FormatEngin e.GetPage(PageRequestContext reqContext)
   CrystalDecisions.ReportSource.LocalReportSourceBas e.GetPage(PageRequestContext pageReqContext)
   CrystalDecisions.Web.ReportAgent.{(Boolean C)
   CrystalDecisions.Web.CrystalReportViewer.OnPreRend er(EventArgs e)
   System.Web.UI.Control.PreRenderRecursiveInternal()
   System.Web.UI.Control.PreRenderRecursiveInternal()
   System.Web.UI.Control.PreRenderRecursiveInternal()
   System.Web.UI.Page.ProcessRequestMain()

The code I am using like below, where "MY_DATABASE" is System ODBC DSN name:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim crReportDocument As New ReportDocument
        Dim crDatabase As Database
        Dim crTables As Tables
        Dim crTable As Table
        Dim crTableLogOnInfo As TableLogOnInfo
        Dim crConnectionInfo As ConnectionInfo
        Dim sAppPath As String
        Dim sFilePath As String
        Dim sTmp As String
        Dim oEncrDescr As EncrDecr

        Try
            If Not IsPostBack Then
                'Create an instance of the strongly-typed report object
                'to make the "Report's Paging" work:
                sAppPath = Request.PhysicalApplicationPath.ToString()
                sFilePath = sAppPath + "Reports\" + Session("ReportName")
                crReportDocument.Load(sFilePath)

                'Create the Conection Info object to hold the logon information for the report
                crConnectionInfo = New ConnectionInfo

                'Populate the ConnectionInfo Objects Properties with the appropriate values for
                'the ServerName, User ID, Password and DatabaseName. However, since Oracle
                'works on Schemas, Crystal Reports does not recognize or store a DatabaseName.
                'Therefore, the DatabaseName property must be set to a BLANK string.
                'If the connection is using ODBC, make sure to use the System DSN name as the ServerName

                With crConnectionInfo
                    .ServerName = "MY_DATABASE" 'system ODBC DSN name
                    .DatabaseName = ""
                    .UserID = ""
                    .Password = ""
                End With

                'Set the CrDatabase Object to the Report's Database
                crDatabase = crReportDocument.Database

                'Set the CrTables object to the Tables collection of the Report's dDtabase
                crTables = crDatabase.Tables

                'Loop through each Table object in the Tables collection and apply the logon info
                'specified ealier. Note this sample only has one table so the loop will only execute once
                For Each crTable In crTables
                    crTableLogOnInfo = crTable.LogOnInfo
                    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
                    crTable.ApplyLogOnInfo(crTableLogOnInfo)
                Next

                If Session("SelectedRegion") = "SW" Then
                    crReportDocument.SetParameterValue("[@FromDate]", Session("ReportSAMPLE_DATE_FROM"))
                    crReportDocument.SetParameterValue("[@ThruDate]", Session("ReportSAMPLE_DATE_TO"))
                    crReportDocument.SetParameterValue("[@Region]", "SW")
                ElseIf Session("SelectedRegion") = "NW" Then
                    crReportDocument.SetParameterValue("[@FromDate]", Session("ReportSAMPLE_DATE_FROM"))
                    crReportDocument.SetParameterValue("[@ThruDate]", Session("ReportSAMPLE_DATE_TO"))
                    crReportDocument.SetParameterValue("[@Region]", "NW")
                Else
                    Session("Message") = "ERROR inside the Page_Load() function. Wrong region has been selected."
                    Response.Redirect("ErrorForm.aspx", False)
                    Exit Sub
                End If

                'Set the ReportSource of the CrystalReportViewer to the strongly typed Report included in the project
                CrystalReportViewer1.ReportSource = crReportDocument

            End If

        Catch ex As Exception 'System.IndexOutOfRangeException
            Session("Message") = "ERROR inside the Page_Load() function. " + ex.Message + ". "
            Response.Redirect("ErrorForm.aspx", False)
            Exit Sub
        End Try
    End Sub

What am I doing wrong?
Thanks in advance,
Dmitriy





Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to connect sultan SQL Server 2005 1 June 6th, 2008 03:38 PM
Unable to connect to server suganya_db SQL Server 2000 1 January 3rd, 2005 09:17 AM
Error in File Crystalreport.rpt Incorrect log on p softles ASP.NET 1.x and 2.0 Application Design 1 July 26th, 2004 10:57 PM
Unable to connect: incorrect log on parameters casjachan ASP.NET 1.x and 2.0 Application Design 2 July 25th, 2004 04:55 PM
incorrect logon parameters syedjavid Crystal Reports 0 December 15th, 2003 11:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.