locked
Custom DataTable for RDLC report. RRS feed

  • Question

  • User336673788 posted

    Hello,

    I'm new to rdlc report and hope someone can help me out.

    I pull data down from the db and change some data and store them into a datatable. This datatable will be bound to the report.

    In VS2008, when creating a Report Wizzard, it automatically helps you to generate a dataset. In my case, I don't want to create a dataset because the datasource is coming from a datatable.

    In my report design view, i added a table (table1) and two textboxes (FName, LName) inside the table.
    FName value is =Fields!FName.Value
    LName value is =Fields!LName.Value

    here's the code:

    ReportViewer.LocalReport.DataSources.Clear();
    ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("MyReport", myDatatable));
    ReportViewer.LocalReport.LocalReport.Refresh();

    Of course, it doesn't work. Error:
    The table "table1" is in the report body but the report has no data set. Data regions are not allowed in reports without datasets.
    The value expression for the textbox "FName" refers to the fields "FName". Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope.

    Same error for LName.


    What this mean is, I need to create a dummy dataset .xsd file? 
    Any input is appreciated. Thank you.


    Wednesday, January 26, 2011 3:15 PM

Answers

  • User336673788 posted

    Okay, I created a dataset->datatable (myDummyData) with two columns FName and LName. File name is MyData.xsd, now when i'm in the report design view, I go to Report->Data Sources, I'm able to select to MyDummyData, click Add to Report .... KABOOM, VS crashes ... sometimes it's able to add, but when I click OK, VS crashes too 


    Been doing this ten times, crashes all the time =( ... What is the alternative way?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 26, 2011 3:47 PM
  • User336673788 posted

    Alright, I solved my own problem with the help of Mr. Google. 

    For those who are planning to do the same, you need to create a dummy dataset first. Annoying! ActiveReport is easier.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 26, 2011 5:42 PM

All replies

  • User336673788 posted

    Okay, I created a dataset->datatable (myDummyData) with two columns FName and LName. File name is MyData.xsd, now when i'm in the report design view, I go to Report->Data Sources, I'm able to select to MyDummyData, click Add to Report .... KABOOM, VS crashes ... sometimes it's able to add, but when I click OK, VS crashes too 


    Been doing this ten times, crashes all the time =( ... What is the alternative way?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 26, 2011 3:47 PM
  • User336673788 posted

    I go the other way, after creating the dataset, I create a report, in the design view, i open up the "Website Data Sources", I see the new dataset that I created. After awhile, I don't see anything in that Website Data Sources anymore???


    What's going on?

    Wednesday, January 26, 2011 4:09 PM
  • User336673788 posted

    Alright, I solved my own problem with the help of Mr. Google. 

    For those who are planning to do the same, you need to create a dummy dataset first. Annoying! ActiveReport is easier.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 26, 2011 5:42 PM