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
Solved

Crystal reports Logon box pops up prompting me for password

Posted on 2008-10-24
3
233 Views
Last Modified: 2012-05-05
Here's what I have now, and am  getting prompted for the password in the logon box, before the report loads. The userid, database, and servername are filled in, but not the password.

Dim rpt as New CrystalDecisions.CrystalReports.Engine.ReportDocument

strConnstring = "Server=servername, Database = dbname, UID=sa, Pwd=Password1"

cn.connectionstring = strConnString
cn.open()

Dim crystalReportViewer1 as new CrystalDecisions.Web.CrystalReportViewer

dim rptPath as string
rptPath = Server.MapPath("Reports\CrystalInvoiceAnnual.rpt")
rpt.load(rptPath)

crystalReportViewer1,ReportSource = rpt
rpt.SetDatabaseLogon("sa", "Password1", "server", "db", True)

Rpt.Load(rptPath)

CrystalReportViewer1.reportsource = rpt
rpt.SetDatabaseLogon("sa","Password1","server", "db",True)

rpt.Refresh
0
Comment
Question by:jbh_blue
  • 2
3 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 22797108
If the report uses multiple tables you have to set the logon info for each table.

Something like this


  Private Sub configureCrystalReports()
        Dim myconnectioninfo As ConnectionInfo = New ConnectionInfo()
       
        With myconnectioninfo
               .DatabaseName = "SomeDatabase"
               .ServerName = "servername"
                .UserID =  "SomeUser"
                .Password = "password"
         end with
        SetDBLogOnForReport(myconnectioninfo)

    End Sub

    Private Sub SetDBLogOnForReport(ByVal myConnectionInfo As ConnectionInfo)
        Dim myTableLogonInfos As TableLogOnInfos = CrystalReportViewer1.LogOnInfo
        For Each myTabeLogoninfo As TableLogOnInfo In myTableLogonInfos
            myTabeLogoninfo.ConnectionInfo = myconnectioninfo
        Next
    End Sub


mlmcc
0
 

Author Comment

by:jbh_blue
ID: 22797171
The report is driven from one view.  I've tried the code that you listed, but got the same results. While inquiring about this problem yesterday, someone suggested the ReportDocument class.

0
 

Author Closing Comment

by:jbh_blue
ID: 31509679
Dude, this didn't really help me solve the problem, but it did help me understand the process (if that makes any sense),  that's why I'm closing and awarding you points.

Thanks for your help,

JB
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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