I think this will help (we had to do it like this to 'refresh' the
connectionstrin g of the reports)...
The SetDatabaseLogo n-method doesn't seem to have the behaviour we would want
it to have :-)
'This method must be called BEFORE the "crvwBnkStmnt.R eportSource =
objRptBnk"!!!!
'SetReportConne ctionString(obj RptBnk)...
Private Sub SetReportConnec tionString(ByRe f repEtat As ReportDocument)
Dim myConnectionInf o As ConnectionInfo = New ConnectionInfo
myConnectionInf o.ServerName =
Configuration.C onfigurationSet tings.AppSettin gs.Get("Crystal Reports\ServerN ame")
myConnectionInf o.DatabaseName =
Configuration.C onfigurationSet tings.AppSettin gs.Get("Crystal Reports\Databas eName")
myConnectionInf o.UserID =
Configuration.C onfigurationSet tings.AppSettin gs.Get("Crystal Reports\UserID" )
myConnectionInf o.Password =
Configuration.C onfigurationSet tings.AppSettin gs.Get("Crystal Reports\Passwor d")
Dim myTableLogOnInf o As New TableLogOnInfo
'Dim myTableLogOnInf os As TableLogOnInfos = crvEtats.LogOnI nfo
'For Each myTableLogOnInf o In myTableLogOnInf os
' myTableLogOnInf o.ConnectionInf o = myConnectionInf o
'Next
myTableLogOnInf o = New TableLogOnInfo
myTableLogOnInf o.ConnectionInf o.ServerName =
Configuration.C onfigurationSet tings.AppSettin gs.Get("Crystal Reports\ServerN ame")
myTableLogOnInf o.ConnectionInf o.DatabaseName =
Configuration.C onfigurationSet tings.AppSettin gs.Get("Crystal Reports\Databas eName")
myTableLogOnInf o.ConnectionInf o.UserID =
Configuration.C onfigurationSet tings.AppSettin gs.Get("Crystal Reports\UserID" )
myTableLogOnInf o.ConnectionInf o.Password =
Configuration.C onfigurationSet tings.AppSettin gs.Get("Crystal Reports\Passwor d")
Dim intX As Integer
For intX = 0 To (repEtat.Databa se.Tables.Count - 1)
repEtat.Databas e.Tables.Item(i ntX).ApplyLogOn Info(myTableLog OnInfo)
Next
End Sub
I hope this helps,
Pieter
"Ravimama" <ma**********@g mail.comwrote in message
news:11******** **************@ h54g2000cwb.goo glegroups.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.GenB nkStmnt(m_iMont h, m_iYear)
'//a unction to load the data
objRptBnk.SetDa taSource(m_DTBa nkStmnt.Tables( 0))
crvwBnkStmnt.Re portSource = objRptBnk
'R&D___________ _____ done by me
Dim objCR As New CRSubReport
'The subreport object
objCR.SetDataba seLogon("sa", "", "raghavendr a",
"db_payroll ") 'Logon info for the report
objRptBnk.OpenS ubreport("CRSub Report.rpt")
'the report
name
'R&D___________ _
Any help will be deeply appreciated.
Ravi