[Last Call] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2005-05-03
Medium Priority
Last Modified: 2011-10-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:

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
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.
Question by:pgkdavefdd
  • 3
  • 2
LVL 10

Expert Comment

ID: 13916242
See if this might help you:
Report.SetDatabaseLogon("username", "password")

LVL 19

Accepted Solution

GJParker earned 1500 total points
ID: 13916574
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


LVL 101

Expert Comment

ID: 13917598
You also need to pass the same information to any subreports and those tables.

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

LVL 19

Expert Comment

ID: 14111299
All postings would help. I suggest spilt points

GJParker 200
Spykair   200
mlmcc    100

LVL 101

Expert Comment

ID: 14117940
Good idea Gary.  Unfortunately with the administrative tool the split must be even.

LVL 19

Expert Comment

ID: 14119482
166.66 each it is then. :-)


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question