Wrox Programmer Forums
BOOK: Professional Crystal Reports for VS.NET
This is the forum to discuss the Wrox book Professional Crystal Reports for Visual Studio .NET by David McAmis; ISBN: 9780764544033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Crystal Reports for VS.NET 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 March 3rd, 2005, 05:13 AM
Registered User
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Logon Failed!


Please check out my code. I get this error when I 'CRViewer.ViewReport' is called.

Logon failed.
Details: ADO Error Code: 0x80030020
Source: MS OLE DB Service Components
Description: A share violation has occured

The code is pretty simple and basic. Is there anything missing or something I didn't declare?

Thanks a lot!


    Dim crxApp As New CRAXDRT.Application
    Dim crxRep As CRAXDRT.Report
    Dim crxDBTable As CRAXDRT.DatabaseTable
    Dim crxDB As CRAXDRT.Database
    Dim crxConn As CRAXDRT.ConnectionProperty


    Screen.MousePointer = vbHourglass


        If CBox.GetPrinterJobs(TReport.DeviceName) <= 2 Then
            Exit Do
        End If

    Select Case UCase(TReport.reportName)
        strFilename = "PDOSchedule"

        strFilename = "PDOCurrent"

    Case "PASTDUE_30DAYS"
        strFilename = "PDO30Days"

        strFilename = "PDOActive"

        strFilename = "PDOSuspended"

        strFilename = "PDOCancelled"

    Case "PASTDUE_ABC"
        strFilename = "PDOABCEmployees"

    End Select

    ' Open crystal report printjob and get number of parameters
    strFilename = UCase(App.Path & "\Reports\" & strFilename & ".rpt")
    strMessage = TPastDue.Message

    ' Open the report
    Set crxRep = crxApp.OpenReport(strFilename)

    ' Set database location
    Set crxDBTable = crxRep.Database.Tables(1)
    crxDBTable.Location = CBox.IniFileRead("Database", "Name")

    ' Pass parameters to report
    With crxRep.ParameterFields
        For i = 1 To .Count
            For j = 0 To .Count - 1
                If Trim(UCase(.Item(i).parameterFieldName)) = Trim(UCase(TReport.Parameters(j, 0))) Then
                    .Item(i).AddCurrentValue TReport.Parameters(j, 1)
                    Exit For
                End If
    End With

    ' Set printer settings
    With TReport
        crxRep.SelectPrinter .DriverName, .DeviceName, .Port
    End With

    ' Set selection formula
    If TReport.Filter <> "" Then
        crxRep.RecordSelectionFormula = TReport.Filter
    End If

    Screen.MousePointer = vbDefault

    With frmReportPreview.CRViewer
        .ReportSource = crxRep
    End With

Similar Threads
Thread Thread Starter Forum Replies Last Post
logon failed serdarbyktmz Crystal Reports 0 April 18th, 2007 10:22 AM
LogOnException: Logon failed leoluvis Crystal Reports 0 February 7th, 2006 05:31 AM
logon failed Rohit Ranjan Crystal Reports 1 February 28th, 2005 06:19 PM
LOGON FAILED! winnie1778 Crystal Reports 1 January 25th, 2005 04:28 AM
Logon failed. msrnivas .NET Web Services 3 January 24th, 2005 02:56 PM

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