Question

I have a few dozen legacy Reports, many of them with Sql Server stored procedures as their data source. I'm trying to use them in an application built with VB.NET 2010 and CR for Visual Studio 2010 version 13.0.2.

When I run a report based on a stored procedure I get an error message saying something like

The table 'REPORT_SCHEDULEB' could not be found

The table definition in the report looks like this:

LogOnInfo.ConnectionInfo for REPORT_SCHEDULEB:
Name: "REPORT_SCHEDULEB", Location: "Proc(REPORT_SCHEDULEB;1)"
AllowCustomConnection: False, DBName: myDb, IntegratedSecurity: False
ServerName: myComputer, User: myName, Password: myPassword, Attributes:
    Database DLL: crdb_ado.dll
    QE_DatabaseName: myDb
    QE_DatabaseType: OLE DB (ADO)
        Auto Translate: -1
        Connect Timeout: 0
        Data Source: myComputer
        General Timeout: 0
        Initial Catalog: myDb
        Integrated Security: False
        Locale Identifier: 1033
        OLE DB Services: -5
        Provider: SQLOLEDB
        Tag with column collation when possible: 0
        Use DSN Default Properties: False
        Use Encryption for Data: 0
        Owner: dbo
    QE_ServerDescription: myComputer
    QE_SQLDB: True
    SSO Enabled: False
    Owner: dbo

I'm guessing that there's some issue with the way the Location field is defined, but

  1. when I try to change the Overridden Qualified Table Name in the report editor it won't accept the change, and
  2. I'd really rather find a programmatic solution than hand-edit dozens of reports.

So, I tried in my code to set the table.Location value, but that throws a COM exception -- I guess it's readonly at some level.

I also thought of the possibility of setting some sort of QualifiedName property but haven't found a way to do that.

Any ideas?

TIA

Was it helpful?

Solution

I've achieved a solution in VB by setting the report datasource at runtime using a datatable created from a stored procedure. That way, all the connection details need only be stored once within the application rather than against each report.

(roughly)

Dim SourceDatabase as datatable = GetDatatableFromSP(SPName)
Dim DocumentToShow as New ReportDocument

DocumentToShow.Load(DocumentPath)
DocumentToShow.SetDataSource(SourceDatabase)

ReportViewer.ViewerCore.ReportSource = DocumentToShow 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top