Failed to open a rowset.
Posted on 2004-03-23
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.CrystalReports.Engine.ReportDocument
Dim i As Integer
Dim logOnInfo As New CrystalDecisions.Shared.TableLogOnInfo
' Loop through every table in the report.
For i = 0 To myReport.Database.Tables.Count - 1
' Set the connection information for current table.
logOnInfo.ConnectionInfo.ServerName = "servername"
logOnInfo.ConnectionInfo.DatabaseName = "dbname"
logOnInfo.ConnectionInfo.UserID = "userid"
logOnInfo.ConnectionInfo.Password = "password"
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 )
Any ideas what is wrong with this?