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!

Change DB server

Status
Not open for further replies.

sinclairgf

Programmer
Nov 14, 2003
9
US
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



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top