Home All Groups Group Topic Archive Search About

Crystal Reports Logon Problem

Author
13 Nov 2006 5:07 AM
Ravimama
I have a report where in I want to display the data from a subreport as
well as a the main report. The sub report is the Company info as the
header, for all the reports. with out a sub report added, the report
works perfectly. Once the sub report is added, every time the login
information is requested and the report does not open.
The following is the code:

m_DSBankStmnt = New DataSet
            objRptBnk = New rptBankStmnt  '//The main report
            objclsBank = New clsBank

            m_iMonth = dStmntDt.Month
            m_iYear = dStmntDt.Year
            m_DSBankStmnt = objclsBank.GenBnkStmnt(m_iMonth, m_iYear)
'//a unction to load the data

                objRptBnk.SetDataSource(m_DTBankStmnt.Tables(0))
                crvwBnkStmnt.ReportSource = objRptBnk

            'R&D________________ done by me
            Dim objCR As New CRSubReport
        'The subreport object
            objCR.SetDatabaseLogon("sa", "", "raghavendra",
"db_payroll") 'Logon info for the report
            objRptBnk.OpenSubreport("CRSubReport.rpt")
      'the report
name

            'R&D____________

Any help will be deeply appreciated.

Ravi

Author
13 Nov 2006 8:36 AM
Pieter
I think this will help (we had to do it like this to 'refresh' the
connectionstring of the reports)...
The SetDatabaseLogon-method doesn't seem to have the behaviour we would want
it to have :-)


'This method must be called BEFORE the "crvwBnkStmnt.ReportSource =
objRptBnk"!!!!
'SetReportConnectionString(objRptBnk)...
Private Sub SetReportConnectionString(ByRef repEtat As ReportDocument)
        Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo
        myConnectionInfo.ServerName =
Configuration.ConfigurationSettings.AppSettings.Get("CrystalReports\ServerName")
        myConnectionInfo.DatabaseName =
Configuration.ConfigurationSettings.AppSettings.Get("CrystalReports\DatabaseName")
        myConnectionInfo.UserID =
Configuration.ConfigurationSettings.AppSettings.Get("CrystalReports\UserID")
        myConnectionInfo.Password =
Configuration.ConfigurationSettings.AppSettings.Get("CrystalReports\Password")

        Dim myTableLogOnInfo As New TableLogOnInfo

        'Dim myTableLogOnInfos As TableLogOnInfos = crvEtats.LogOnInfo
        'For Each myTableLogOnInfo In myTableLogOnInfos
        '    myTableLogOnInfo.ConnectionInfo = myConnectionInfo
        'Next

        myTableLogOnInfo = New TableLogOnInfo
        myTableLogOnInfo.ConnectionInfo.ServerName =
Configuration.ConfigurationSettings.AppSettings.Get("CrystalReports\ServerName")
        myTableLogOnInfo.ConnectionInfo.DatabaseName =
Configuration.ConfigurationSettings.AppSettings.Get("CrystalReports\DatabaseName")
        myTableLogOnInfo.ConnectionInfo.UserID =
Configuration.ConfigurationSettings.AppSettings.Get("CrystalReports\UserID")
        myTableLogOnInfo.ConnectionInfo.Password =
Configuration.ConfigurationSettings.AppSettings.Get("CrystalReports\Password")

        Dim intX As Integer
        For intX = 0 To (repEtat.Database.Tables.Count - 1)
            repEtat.Database.Tables.Item(intX).ApplyLogOnInfo(myTableLogOnInfo)
        Next
End Sub


I hope this helps,

Pieter


Show quoteHide quote
"Ravimama" <mailto.lr***@gmail.com> wrote in message
news:1163394420.914106.283480@h54g2000cwb.googlegroups.com...
>I have a report where in I want to display the data from a subreport as
> well as a the main report. The sub report is the Company info as the
> header, for all the reports. with out a sub report added, the report
> works perfectly. Once the sub report is added, every time the login
> information is requested and the report does not open.
> The following is the code:
>
> m_DSBankStmnt = New DataSet
>            objRptBnk = New rptBankStmnt  '//The main report
>            objclsBank = New clsBank
>
>            m_iMonth = dStmntDt.Month
>            m_iYear = dStmntDt.Year
>            m_DSBankStmnt = objclsBank.GenBnkStmnt(m_iMonth, m_iYear)
> '//a unction to load the data
>
>                objRptBnk.SetDataSource(m_DTBankStmnt.Tables(0))
>                crvwBnkStmnt.ReportSource = objRptBnk
>
>            'R&D________________ done by me
>            Dim objCR As New CRSubReport
>        'The subreport object
>            objCR.SetDatabaseLogon("sa", "", "raghavendra",
> "db_payroll") 'Logon info for the report
>            objRptBnk.OpenSubreport("CRSubReport.rpt")
>      'the report
> name
>
>            'R&D____________
>
> Any help will be deeply appreciated.
>
> Ravi
>