cancel
Showing results for 
Search instead for 
Did you mean: 

ReportDocument.SetDataSource throws excption when running from setup

Former Member
0 Kudos

Hello SAP,

I am creating an application in which I required to creating a crystal report.

To assign the data Table to crystal report I had written following code.

Dim frmPreview As New frmPreview With {.strReportLocation = PstrReportFilename2_Work, .strReportDbLoacation = PstrDatabaseName2_Work}

Dim Report As New ReportDocument

Dim oledbConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & frmPreview.strReportDbLoacation & ";User Id=admin;Password=;"

            Dim ConDb As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(oledbConnectionString)

            ConDb.Open()

Dim dataAdapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM TK3320530", ConDb)

            Dim dataTable As New DataTable("Report2")

            dataAdapter1.Fill(dataTable)

            Report.Load(frmPreview.strReportLocation)

            Report.SetDataSource(dataTable)

frmPreview.CrystalReportViewer1.ReportSource = Report

This code works fine in development environment but when I build it and run from .exe file.

It throws the exception. at  Report.SetDataSource(dataTable) statement

I am attaching a screenshot of stack trace and error message. Please take a moment to review it.

Thanks,

Rudresh Bhatt

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

You don't say what version of CR and .NET, so please provide that.

Also, my Japanese is not so good. I can struggle through English, Spanish, Portuguese, Czech and perhaps even Italian and French, but not Japanese . Can you translate the errors?

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos
Hello Mr. Ludek,


Thanks for reply


I am using Crystal report 2011 and vb.net 4.5


StackTrace message:


Place CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)

Location Cystaldecisions.cystalepots.engine.epotdocument.setdatasouceintenal(object val, Type type)

Location CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)

Location TK3320500. FLG TK3320510bas.SUB_RptDsp3(Int32&, Boolean& DLG)


Exception Message:

Failed to load database information. .Rpt file TK3320530 {D2A808D2-0DF3-4416-A64B-B91749920835}

The error: failed to load database information.

Thnaks & regards,

Rudresh Bhatt

former_member183750
Active Contributor
0 Kudos

See if this helps;

Find the search box in the top right corner. Enter the search string 'crystal failed load database information'. When the results come up, look at the left side of the screen and under "Asset Type" select Support Notes. This will give you a good selection of KBAs to consult.

- Ludek

0 Kudos

Add this to your app.config file:

<startup useLegacyV2RuntimeActivationPolicy="true">

Don

Former Member
0 Kudos

Hello Mr. luke,

I will try your suggession.

Thanks for reply

Rudresh Bhatt

Former Member
0 Kudos

Hello, Mr. Don

I had already tried your solution, but it is not working.

If you have another way then please help me.

Thanks for your reply

Rudresh Bhatt

former_member188030
Active Contributor
0 Kudos

Hi Rudresh,

Instead of passing the datatable to report, could you print it to a datagrid on production and see if the datatable actually has any data?

Also, you could write the data to an XML file and then try to map it against the report fields. See if it throws any error message.

I suspect this could be an issue with data table fetching the data or its field mapping with the report.

Thanks,

Bhushan

Answers (0)