[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Crystal Reports Runtime/database login information

Posted on 2004-09-21
5
Medium Priority
?
473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
 
LVL 1

Accepted Solution

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

Computer101
E-E Admin
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

656 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