By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

Crystal Reports Logon Problem

P: n/a
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

Nov 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.Ge t("CrystalReports\ServerName")
myConnectionInfo.DatabaseName =
Configuration.ConfigurationSettings.AppSettings.Ge t("CrystalReports\DatabaseName")
myConnectionInfo.UserID =
Configuration.ConfigurationSettings.AppSettings.Ge t("CrystalReports\UserID")
myConnectionInfo.Password =
Configuration.ConfigurationSettings.AppSettings.Ge t("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.Ge t("CrystalReports\ServerName")
myTableLogOnInfo.ConnectionInfo.DatabaseName =
Configuration.ConfigurationSettings.AppSettings.Ge t("CrystalReports\DatabaseName")
myTableLogOnInfo.ConnectionInfo.UserID =
Configuration.ConfigurationSettings.AppSettings.Ge t("CrystalReports\UserID")
myTableLogOnInfo.ConnectionInfo.Password =
Configuration.ConfigurationSettings.AppSettings.Ge t("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
"Ravimama" <ma**********@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.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

Nov 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.