Link to home
Start Free TrialLog in
Avatar of srinivas_gowd
srinivas_gowd

asked on

Login Failed Error while Calling a Crystal Report 9.0 from Visual Basic Application

Hi All,
Please help me,i was totally strucked,

i have designed a crystal report,using 2 oracle tables(Emp,dept from Scott user),and now i am trying to call it from visual basic using follwing code

***********************
Option Explicit

Dim rs As ADODB.Recordset               'HOLDS ALL DATA RETURNED FROM QUERY
Dim crystal As CRAXDRT.Application      'LOADS REPORT FROM FILE
Dim report As CRAXDRT.report
Dim crxDataBase As CRAXDRT.Database
Dim crxTables As CRAXDRT.DatabaseTables
Dim crxTable As CRAXDRT.DatabaseTable


Private Sub Form_Load()
On Error GoTo ErrorHandler
Dim Count As Integer
Dim i
Dim j
Dim tb

Me.WindowState = 2
     
    Dim conn As ADODB.Connection            'CONNECTION TO BROKER QUERIES
    CRViewer.DisplayBorder = False          'MAKES REPORT FILL ENTIRE FORM
    CRViewer.DisplayTabs = False            'THIS REPORT DOES NOT DRILL DOWN, NOT NEEDED
    CRViewer.EnableDrillDown = False        'REPORT DOES NOT SUPPORT DRILL-DOWN
    CRViewer.EnableRefreshButton = False    'ADO RECORDSET WILL NOT CHANGE, NOT NEEDED
    Set conn = New ADODB.Connection
    conn.CursorLocation = adUseClient       'SERVER-SIDE NOT RECCOMENDED
    conn.ConnectionString = "PROVIDER=MSDAORA.1;PASSWORD=TIGER;USER ID=SCOTT;DATA SOURCE=NISAG"
    conn.Open
    Set rs = New ADODB.Recordset
    rs.Open "Select * from emp", conn, adOpenForwardOnly, adLockReadOnly
    Set crystal = New CRAXDRT.Application           'MANAGES REPORTS
    Set report = crystal.OpenReport(App.Path & "\emp_dept.rpt")   'OPEN OUR REPORT
    report.Database.SetDataSource rs             'LINK REPORT TO RECORDSET
    report.DiscardSavedData                      'CLEARS REPORT SO WE WORK FROM RECORDSET
    CRViewer.ReportSource = report              'LINK VIEWER TO REPORT
    CRViewer.ViewReport                         'SHOW REPORT
    Do While CRViewer.IsBusy              'ZOOM METHOD DOES NOT WORK WHILE
        DoEvents                          'REPORT IS LOADING, SO WE MUST PAUSE
    Loop                                  'WHILE REPORT LOADS.
    CRViewer.Zoom 94
    rs.Close                            'ALL BELOW HERE IS CLEANUP
    Set rs = Nothing
    conn.Close
    Set conn = Nothing
    Set crystal = Nothing
    Set report = Nothing
    Exit Sub
ErrorHandler:
    MsgBox "Form Load : " & Err.Description, vbInformation, "Report Viewer"

End Sub

*********************

this giving the follwinhg error,

Login failed.
Details:ADO Error Code:0x80004005
source:oraoledb
description:ORA-01005:null password given;logon denied
native error:1005


Please give me a solution,i will be very thankful to u,



Thanks in advance

Srinivas Gowd
srinivas_gowd@yahoo.co.uk

ASKER CERTIFIED SOLUTION
Avatar of Sethi
Sethi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MYLim
MYLim

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Point Split between Sethi and MYLim

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

MYLim
EE Cleanup Volunteer