Using Two TableAdapters in One Report File (Visual Studio 2005)

Last post 06-05-2009 3:52 PM by therealgeddylee. 1 replies.

Sort Posts:

  • Using Two TableAdapters in One Report File (Visual Studio 2005)

    06-05-2009, 3:28 PM
    Hey everyone,
    I have been trying for several hours to figure out why I cannot get this to work properly, but I cannot figure out how to do it. Basically, this is my setup:
    -1 aspx page
    -on the page, one reportviewer control, linked to a local report
    -1 report file (rdlc)
    -1 DataSet with 2 TableAdapters, both tableadapters with their own query.


    Now, when I edit the report file, I have a table that I dragged the appropriate fields onto for the first Table Adapter, called just DataTable1.

    Also on the report file is another table that should display data from the second tableadapter, DataTable2. However, when I go to drag columns from the Webite Data Sources panel, instead of the usual =Fields!column.Value expression being added to the cell, it's making it =First(Fields!mv_fault2.Value, "DataSet1_DataTable2") for the first column, and =Sum(Fields!currentYear_minusFive2.Value, "DataSet1_DataTable2") for the rest of them.

    So when I run the report, there is data displayed, but the first expression messes up the data that is returned. If I change each one to just =Fields!columnname.value, I get the following error: "Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope."

    Does anyone know how I could use returned data from both of my tableadapters in the same rdlc file?

    Thanks!
  • Re: Using Two TableAdapters in One Report File (Visual Studio 2005)

    06-05-2009, 3:52 PM
    Answer
    Woops, nevermind. I resolved the issue by creating a subreport in the report file, and magically that made me able to reference data from the secondary tableadapter. :)
Page 1 of 1 (2 items)