Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field not found when run from .Net

Status
Not open for further replies.

ThatRickGuy

Programmer
Oct 12, 2001
3,841
US
Hey, I'm having some problems running a crystal report (v9) in a VB.Net (2002) application.

The report is based off of a file dsn to a text file using the microsoft text driver. it runs fine in the CR developer.

When running the report in .Net w/ a Report Viewer control, I'm getting "Field Not Known" errors on any fields that are used in a formula. If I remove all of the formula's, the control loads, but w/ a blank report, as if there isn't any data.

The code I'm using to load the report in .Net is this:
Code:
    Dim cr As New CrystalDecisions.CrystalReports.Engine.ReportDocument()

    cr.Load(ReportPath & reportName)

    cr.Refresh()
    CrystalReportViewer1.ReportSource = cr

using these lines:
Code:
    Debug.WriteLine(cr.Database.Tables.Item(0).Fields(0).Name())
    Debug.WriteLine(cr.Database.Tables.Item(0).Fields(1).Name())
    Debug.WriteLine(cr.Database.Tables.Item(0).Fields(2).Name())
    Debug.WriteLine(cr.Database.Tables.Item(0).Fields(3).Name())
I can see all of the field names. But as soon as I .show the form I get an error message about the field in formula is not known. The only difference I see is that the fields in the database object come out as "PATH", "FILE NAME", "SIZE", and "DATE" where as the formulas use "FileList_txt.PATH" and "FileList_txt.SIZE". The formulas are very simple, mostly there just for formating. Like the <SizeInMegs> formula:
Code:
{FileList_txt.SIZE}/1000000
which gives me this:
Error in File ...\Report1.rpt:
Error in formula <SizeInMegs>.
'{FileList_txt.SIZE}/1000000
'
This field name is not known.

Anyone run into this before?

-Rick

----------------------
 
Ahh well, I finally gave up on using a text file and switched to XML. For some reason crystal reports beleives XML > Flat files. who knows, but it works now.

-Rick

----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top