Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 24th, 2006, 10:49 PM
Registered User
 
Join Date: Feb 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to thiNkspAce
Default dialog display when viewing the report

why is it that when i have join statement in my query string and run my report there's a dialog box will show asking for Server Name, Database, User Name and Password? but if i read on 1 table in the database it works fine. im using the cr which is bundled in visual studio .net. i really have trouble with this and i need ur help. i tried searching in google but i haven't found any answer. any suggestions or code snippet will be greatly appreciated!

regards

 
Old March 27th, 2006, 01:53 AM
Authorized User
 
Join Date: Sep 2005
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to vijaykumartaduri Send a message via Yahoo to vijaykumartaduri
Default

Hi,

  You need to provide DB details explicitly to the report.

Try with below block
'-----------------------------

 Private Sub LogOnReport(ByVal cr As CrystalDecisions.CrystalReports.Engine.ReportDocum ent)
        Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
        Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
        For Each myTable In cr.Database.Tables
            myLogin = myTable.LogOnInfo
            myLogin.ConnectionInfo.ServerName = strInfo(0)
            myLogin.ConnectionInfo.DatabaseName = strInfo(1)
            myLogin.ConnectionInfo.UserID = strInfo(2)
            myLogin.ConnectionInfo.Password = strInfo(3)
            myTable.ApplyLogOnInfo(myLogin)
          Next
'If report has any subreports then use this
        Dim RepObject As CrystalDecisions.CrystalReports.Engine.ReportObjec t
        Dim SubRepDoc As CrystalDecisions.CrystalReports.Engine.SubreportOb ject
        Dim RepDoc As CrystalDecisions.CrystalReports.Engine.ReportDocum ent
        For Each RepObject In cr.ReportDefinition.ReportObjects
            If RepObject.Kind = CrystalDecisions.Shared.ReportObjectKind.Subreport Object Then
                SubRepDoc = CType(RepObject, CrystalDecisions.CrystalReports.Engine.SubreportOb ject)
                RepDoc = cr.OpenSubreport(SubRepDoc.SubreportName)
                For Each myTable In RepDoc.Database.Tables
                    myLogin = myTable.LogOnInfo
                    myLogin.ConnectionInfo.ServerName = strInfo(0)
                    myLogin.ConnectionInfo.DatabaseName = strInfo(1)
                    myLogin.ConnectionInfo.UserID = strInfo(2)
                    myLogin.ConnectionInfo.Password = strInfo(3)
                    myTable.ApplyLogOnInfo(myLogin)
                  Next
            End If
        Next

    End Sub

'----------------------------







Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report Exception Error when viewing aquiintac VB Components 0 November 7th, 2007 11:12 PM
MFC App fails trying to display a dialog cont pkam Visual C++ 1 August 16th, 2007 10:55 AM
Image appears as red 'X' when viewing a report usi brunoals Crystal Reports 0 September 28th, 2006 10:36 AM
viewing MS Access report from VB 6.0 jthadathilm16 Pro VB Databases 1 May 4th, 2006 08:15 PM
Viewing Crystal Report sorted by CustomerId ronbora Crystal Reports 0 November 18th, 2004 10:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.