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

x
?
Solved

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

Posted on 2005-05-03
8
Medium Priority
?
823 Views
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
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.
0
Comment
Question by:pgkdavefdd
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

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

Hth,
Spykair
0
 
LVL 19

Accepted Solution

by:
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
Next

HTH

Gary
0
 
LVL 101

Expert Comment

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

mlmcc
0
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

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

GJParker 200
Spykair   200
mlmcc    100

Gary
0
 
LVL 101

Expert Comment

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

mlmcc
0
 
LVL 19

Expert Comment

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

Gary
0

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