How to pass SQL Server Password from Crystal 9 viewer using VB6 Crystal Report Designer Component
Posted on 2005-05-03
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:
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
Screen.MousePointer = vbDefault
Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth
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.