Solved

Crystal Reports Runtime/database login information

Posted on 2004-09-21
5
469 Views
Last Modified: 2008-02-01
I have a windows form with a CrystalReportViewer, button, and OpenFileDialog.

I would like the user to be able to select the report to view but I want the application to supply the username/password.  I really don't want the Database Login dialog box to appear.  Is this possible?

I tried:
 Private Sub btnOpenReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenReport.Click
        OpenFileDialog1.Filter = "Crystal Reports|*.RPT"
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            CrystalReportViewer1.ReportSource = OpenFileDialog1.FileName
        End If

    End Sub

    Private Sub CrystalReportViewer1_ReportRefresh(ByVal source As Object, ByVal e As CrystalDecisions.Windows.Forms.ViewerEventArgs) Handles CrystalReportViewer1.ReportRefresh
        Dim logOnInfo As New TableLogOnInfo
        logOnInfo.ConnectionInfo.ServerName = "servername"
        logOnInfo.ConnectionInfo.DatabaseName = ""
        logOnInfo.ConnectionInfo.UserID = "username"
        logOnInfo.ConnectionInfo.Password = "password"
        CrystalReportViewer1.LogOnInfo.Add(logOnInfo)
    End Sub
0
Comment
Question by:wykzimme
5 Comments
 
LVL 1

Expert Comment

by:redundguy
ID: 12121420
Try

Instead of
CrystalReportViewer1.LogOnInfo.Add(logOnInfo)

you can use:
vnt=reportdocumentobject.Database.tables.count
for i=0 to vnt-1
    reportdocumentobject.Database.tables(i).ApplyLogonInfo(logoninfo)
next

and maybe you need:
logoninfo=reportdocumentobject.Database.tables(0).logoninfo
before:
logOnInfo.ConnectionInfo.ServerName = "servername"

George
0
 

Author Comment

by:wykzimme
ID: 12341069
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12393676
PAQed, with points refunded (50)

Computer101
E-E Admin
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

792 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