sinclairgf
Programmer
I am tring to change the databse information for a report. The following code is what I am trying to do but is not working.
' *********************************************************
' Preview the current report
'
Function PreviewReport()
Dim HTMLViewer
' Initialize the viewer - it doesn't require being stored in session
Set HTMLViewer = ObjectFactory.CreateObject("CrystalReports.CrystalReportViewer"
With HTMLViewer
.ReportSource = clientDoc.ReportSource
.Name = reportPreviewName
.IsOwnForm = true
.IsOwnPage = true
.IsDisplayGroupTree = true
.IsDisplayToolbar = true
.IsDisplayPage = true
.HasRefreshButton = true
End With
' Update the database information
' Set the database information
Dim cons, con, propBag
Set propBag = Server.CreateObject("CrystalReports.PropertyBag"
propBag.Item("Connection String" = "Provider=SQLOLEDB.1;Data Source=servername;Initial Catalog=databaseName;User ID=username;Password=password;"
Set con = ObjectFactory.CreateObject("CrystalReports.ConnectionInfo"
con.Attributes = propBag
con.UserName = "username"
con.Password = "password"
Set cons = ObjectFactory.CreateObject("CrystalReports.ConnectionInfos"
cons.Add con
HTMLViewer.DatabaseLogonInfos = cons
HTMLViewer.ProcessHttpRequest Request, Response, Session
End Function
' *********************************************************
' Preview the current report
'
Function PreviewReport()
Dim HTMLViewer
' Initialize the viewer - it doesn't require being stored in session
Set HTMLViewer = ObjectFactory.CreateObject("CrystalReports.CrystalReportViewer"
With HTMLViewer
.ReportSource = clientDoc.ReportSource
.Name = reportPreviewName
.IsOwnForm = true
.IsOwnPage = true
.IsDisplayGroupTree = true
.IsDisplayToolbar = true
.IsDisplayPage = true
.HasRefreshButton = true
End With
' Update the database information
' Set the database information
Dim cons, con, propBag
Set propBag = Server.CreateObject("CrystalReports.PropertyBag"
propBag.Item("Connection String" = "Provider=SQLOLEDB.1;Data Source=servername;Initial Catalog=databaseName;User ID=username;Password=password;"
Set con = ObjectFactory.CreateObject("CrystalReports.ConnectionInfo"
con.Attributes = propBag
con.UserName = "username"
con.Password = "password"
Set cons = ObjectFactory.CreateObject("CrystalReports.ConnectionInfos"
cons.Add con
HTMLViewer.DatabaseLogonInfos = cons
HTMLViewer.ProcessHttpRequest Request, Response, Session
End Function