Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET Page changing CR9 datasource at runtime 1

Status
Not open for further replies.

ciscowiz

MIS
Apr 21, 2004
146
US
Well like the subject says, can/how would it be done? We have many different databases on a sql server that utilize the same report but we have to keep multiple copies of the reports for each database/datasource. The reports are called through an ASP.NET page and use the activeX viewer in an IE browser to display. Thanks - Bryan
 
If you look at the code in that sample a "Tables" collection is declared.

Dim CrTables As Tables
Dim CrTable As Table
Dim TableCounter

When I do this in VS.NET 2003 I get an error "Type 'Tables' is not defined"

Any idea of a fix for this?
 
Give this a try..

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Shared

Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crLogOnInfo As TableLogOnInfo
Dim crConnInfo As New ConnectionInfo()

after that I use
crDatabase = crRepDoc.Database
crTables = crDatabase.Tables

For Each crTable In crTables
With crConnInfo
If UseRptServer = True And ReportingServerOnline Then
.ServerName = ConfigurationSettings.AppSettings("ReportServerName")
.DatabaseName = ConfigurationSettings.AppSettings("ReportDatabaseName")
.UserID = ConfigurationSettings.AppSettings("ReportUserID")
.Password = ConfigurationSettings.AppSettings("ReportPassWord")
Else
.ServerName = ConfigurationSettings.AppSettings("OLEDBServerName")
.DatabaseName = ConfigurationSettings.AppSettings("OLEDBDatabaseName")
.UserID = ConfigurationSettings.AppSettings("OLEDBUserID")
.Password = ConfigurationSettings.AppSettings("OLEDBPassWord")
End If
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crConnInfo
crTable.ApplyLogOnInfo(crLogOnInfo)

remember that if you have any sub reports then you must loop thru them and do this again

good luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top