Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 19, 2008 at 05:53 PM

    I did futher testing on this issue. I logged onto the SQL server pc and added my development pc to the administrators group (which is not a good solution) and wala it works.

    I then opened the SQL profiler and checked the sql statements and I could see the sql command that I used coming as the logged in windows user in to sql, but the table sql statement comes as my pc's name. The moment I remove the pc from the administrators groups and run the report, I only see the first sql command. The second one does not come at all. I think this is a permission problem, but I don't know how to fix this.

    Any help is greatly appreciated.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      What I found out was when I run the report in my web page. It first authenticates with the correct nt user id and executes one sql statement. The moment it finds the sql command, it drops the nt user and tries to connect to the server using my pc's account ntscp\W2376$

      W2376 is the name of my pc. System does connect with the correct user for the very first sql, and then it disconnects. If I use only tables in my reports system connects with the proper nt user and executes the report without any problems. I believe the culprit is the SQL command. When using sql command some how the web site drps the nt user in the middle of running.

      This does not happen when I run the report within VS2005.

      I did few more changes to my dsn, I created an sql user and used that in the dsn and changed the code accordingly and deployed the web site. Everything works this way. But I must have the intergrated security enabled for some reports.

      Can any one help?

  • Jan 09, 2009 at 07:03 PM

    When creating the report and check on Trusted Authentication in the Database wizard

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Don,

      I actually tracked this issue recently for OLE DB and it's be fixed and should be included in a patch shortly. It has been scheduled for FP 4 which should be out mid march. You may have to convert all your reports to use MS OLE DB provider. I'll add a note to the track to get R&D to test using ODBC also.

      The problem is the Trusted connection is not getting migrated to each connection, stops after the first connection.

      The internal tracking number is: ADAPT01171567

      To get you by for now here's a link and info to download a beta build of the dll, it has not been fully regression tested so test it first and it should not be shipped without warning. It also has a dependency on Service Pack 3.1.

      EXTERNAL DOWNLOAD SITE :

      ftp://ftp1.businessobjects.com/outgoing/CHF/beta/XI3.1_LAFix0.0.22.zip

      ADDITIONAL INFORMATION

      Special Instructions :

      1. Stop all related services.

      2. Rename and backup crdb_ado.dll in C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86

      3. Copy and place the new crdb_ado.dll into the location.

      4. Restart all related services.

      New Behavior : The issue is resolved.

      Limitations : N/A

      Component(s): LAFix released on top of XI 3.1

      crdb_ado.dll

      Thank you

      Don

      Edited by: Don Williams on Jan 21, 2009 10:13 AM