Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ASP.NET / Crystal error

I have written an application that allows me to add reports and view them in the web browser. Everything works perfect if I use tables. The moment I use sql commands, it gives me many problems. Still if I use one sql command everything is good.

I have the following scenario.

When I use a report with one sql command and one table, I get the following error :

Invalid Argument provided. Failed to open a rowset. Error in File C:\Temp\report1 {F0AAC473-3B29-4D67-ACCE-79F7AA3B0738}.rpt: Invalid argument for database.

When I use more than one SQL command, I get the following error :

Failed to open a rowset. Details: 08003:[Microsoft][ODBC Driver Manager] Connection not open Failed to open a rowset. Error in File C:\Temp\16-Oct-2008114840_2_SQLCommand_medecaretest {B0224037-4CB5-4DD4-B10B-2D26E3AFA274}.rpt: Failed to open a rowset.

When I run the same reports in VS2005 project everything works. But when I deploy it, I have all those above problems. To check more about this, I deployed the application into the development pc itself and I still get the error.

All the above reports use an SQL ODBC connection to get data from another server. All ODBC connections use intergrated security.

I am not sure how to fix this. I googled it, no luck so far. And I am stuck with this for the past 2 weeks. Any help is greatly appreciated.

I am using the following code to display the report.

Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext

Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity

currentWindowsIdentity = CType(User.Identity, System.Security.Principal.WindowsIdentity)

impersonationContext = currentWindowsIdentity.Impersonate()

Dim myReport As New ReportDocument

Dim reportPath As String = Server.MapPath("Reports\" & "report1.rpt")

myReport.Load(reportPath)

Dim crLogin As New ApplyCRLogin

crLogin._dbName = myReport.DataSourceConnections.Item(0).DatabaseName

'''crLogin._passWord = ""

crLogin._serverName = myReport.DataSourceConnections.Item(0).ServerName

'''crLogin._userID = ""

crLogin._integratedSecurity = myReport.DataSourceConnections.Item(0).IntegratedSecurity

crLogin.ApplyInfo(myReport)

crLogin = Nothing

CrystalReportViewer1.ReportSource = myReport

impersonationContext.Undo()

Following is the applycrlogin class :

Public Class ApplyCRLogin

Public _dbName As String

Public _serverName As String

Public _userID As String

Public _passWord As String

Public _integratedSecurity As Boolean

Public Sub ApplyInfo(ByRef _oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)

Dim oCRDb As CrystalDecisions.CrystalReports.Engine.Database = _oRpt.Database()

Dim oCRTables As CrystalDecisions.CrystalReports.Engine.Tables = oCRDb.Tables()

Dim oCRTable As CrystalDecisions.CrystalReports.Engine.Table

Dim oCRTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo

Dim oCRConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo

oCRConnectionInfo.DatabaseName = _dbName

oCRConnectionInfo.ServerName = _serverName

oCRConnectionInfo.UserID = _userID

oCRConnectionInfo.Password = _passWord

oCRConnectionInfo.IntegratedSecurity = _integratedSecurity

For Each oCRTable In oCRTables

oCRTableLogonInfo = oCRTable.LogOnInfo()

oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo

oCRTable.TestConnectivity()

oCRTable.ApplyLogOnInfo(oCRTableLogonInfo)

Next

End Sub

End Class

Not what you were looking for? View more on this topic or Ask a question