How to pass SQL Server Password from Crystal 9 viewer using VB6 Crystal Report Designer Component

I'm using the Crystal 9 Report Designer Component (RDC) in VB6 to build a report from data on a SQL Server 2000 DB that has a secure password.  When building the report I created a new connection using the crystal ADO ODBC. wizard.  the wizard prompted me for the user ID and password at that time and when I tested the connection it worked.  However, when I call the report from the CRViewer91, I get the following error:

Logon Failed
Details: ADO Error Code: 0x8004e4d.
Source: Microsoft OLE DB Provider for SQL Server.
Description: Login failed for user 'PSLuser'.
SQL State: 42000
native Error: 18456



This is the VB Code I used on the CRViewer91 viewer form:

Dim Report As New CrystalReport7

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
CRViewer91.ReportSource = Report
Report.PrinterSetup frmActiveSummary.Hwnd
CRViewer91.ViewReport
Screen.MousePointer = vbDefault

End Sub

Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth

End Sub

Can you advise what is causing this error?  I think that the logon information is not saved and I will need to pass it .  Can someone please advise what I am doing wrong and provide the VB code  needed to pass the logon information to  SQL Server 2000 DB from the viewer.
pgkdavefddAsked:
Who is Participating?
 
GJParkerConnect With a Mentor Commented:
you need to do this for each db table

Dim dbTable As CRAXDRT.DatabaseTable

For Each dbTable In Report.Database.Tables
    dbTable.SetLogOnInfo sServer, sServer, UserId, Password
Next

HTH

Gary
0
 
SpykairCommented:
See if this might help you:
Report.SetDatabaseLogon("username", "password")

Hth,
Spykair
0
 
mlmccCommented:
You also need to pass the same information to any subreports and those tables.

mlmcc
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
GJParkerCommented:
All postings would help. I suggest spilt points

GJParker 200
Spykair   200
mlmcc    100

Gary
0
 
mlmccCommented:
Good idea Gary.  Unfortunately with the administrative tool the split must be even.

mlmcc
0
 
GJParkerCommented:
166.66 each it is then. :-)

Gary
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.