I have a crystal report which I created to show details from one table on a database. I am using the crystal viewer on an ASP.Net page to view the report and it works fine until I switch to a different database. I want to use the same report to look at both databases - one of which is our test server - and not have to maintain 2 copies of the report pointing to each server. Here is the code I have now:
Dim myreport As New CrystalDecisions.CrystalRe
ports.Engi
ne.ReportD
ocument
Dim i As Integer
Dim logOnInfo As New CrystalDecisions.Shared.Ta
bleLogOnIn
fo
myreport.Load(Server.MapPa
th("Report
s/TestRepo
rt6.rpt"))
' Loop through every table in the report.
For i = 0 To myReport.Database.Tables.C
ount - 1
' Set the connection information for current table.
logOnInfo.ConnectionInfo.S
erverName = "servername"
logOnInfo.ConnectionInfo.D
atabaseNam
e = "dbname"
logOnInfo.ConnectionInfo.U
serID = "userid"
logOnInfo.ConnectionInfo.P
assword = "password"
myReport.Database.Tables.I
tem(i).App
lyLogOnInf
o(logOnInf
o)
Next i
myreport.Refresh()
CRV1.ReportSource = myreport
CRV1.Visible = True
CRV1 is the crystal viewer. when I use server1/db1 on which the report was developed it is fine but when I change to server2/db2 - a copy of the first database with all of the same users, permissions, etc, I get this error: Failed to open a rowset.
[InternalException: Failed to open a rowset.]
.I(String , EngineExceptionErrorID )
.D(Int16 , Int32 )
.C(Int16 )
CrystalDecisions.CrystalRe
ports.Engi
ne.FormatE
ngine.GetP
age(PageRe
questConte
xt reqContext)
CrystalDecisions.ReportSou
rce.LocalR
eportSourc
eBase.GetP
age(PageRe
questConte
xt pageReqContext)
CrystalDecisions.Web.Repor
tAgent.u(B
oolean a)
CrystalDecisions.Web.Cryst
alReportVi
ewer.OnPre
Render(Eve
ntArgs e)
System.Web.UI.Control.PreR
enderRecur
siveIntern
al()
System.Web.UI.Control.PreR
enderRecur
siveIntern
al()
System.Web.UI.Control.PreR
enderRecur
siveIntern
al()
System.Web.UI.Page.Process
RequestMai
n()
Any ideas what is wrong with this?
Start Free Trial