Report View won't work?

Where have I lost it I’m just trying to do a real simple report. Dropped a CR Report viewer on a panel on the form.

mytable = New DataTable("MyTable")
With Mytable
.Columns.Add("Field1", GetType(String))
.Columns.Add("Field2", GetType(String))
.Columns.Add("Field3", GetType(Int32))
.Columns.Add("Field4", GetType(Int32))
.Columns.Add("Field5", GetType(Int32))
.Columns.Add("Field6", GetType(Int32))
.Columns.Add("Field7", GetType(Int32))
.Columns.Add("Field8", GetType(String))
.Columns.Add("Field9", GetType(String))
End With
MyTable.PrimaryKey = New DataColumn() {MyTable.Columns("Field1")}


Put some stuff into the table

Dim oRpt as New CrystalDecisions.CrystalReports.Engine.ReportDocument()
oRpt.Load("My.rpt")
oRpt.SetDataSource(MyTable)
CrystalReportViewer1.DataSource = oRpt   *Error here
CrystalReportViewer1.DataBind()


Error returned:
HierarchicalDataBoundControl only accepts data sources that implement IHierarchicalDataSource or IHierarchicalEnumerable

Can you not use a datatable that you build in code at run time
Or have I totally missed how to do this

TIA


Answer this question

Report View won't work?

  • patricef

    Thanks,

    Do you know how many hours I've looked at that code and tryed everything I could to get it to work. MAN I HATE IT WHEN I DO STUPID THINGS LIKE THAT.

    Jeff

  • hpannu

    Hello,

    It looks like you are not setting the CrystalReportViewer properly.

    It should be:

    CrystalReportViewer1.ReportSource = oRpt

    Give that a try - you can also check out the samples at:

    www.businessobjects.com/devzone

    Keith - Business Objects

  • Report View won't work?