Search code examples
c#winformsdatatabledatasetreportviewer

Trouble Setting Tables as Static DataTables for Reporting Viewer Integration


I'm attempting to designate these tables as static DataTables, but I'm encountering issues utilizing this data in another class. Ultimately, I aim to integrate this functionality with Reporting Viewer. Could someone kindly offer assistance? Thank you.

enter image description here


Solution

  • Alright everyone,

    I've found the solution to the problem. It turns out that we can't directly set a DataTable in a DataSet as static. However, when utilizing this DataSet in another Form, like in ReportViewer, a new DataSet element is created in the Form.

    To resolve this, simply follow these steps:

    1. Click on the DataSet in the Form.
    2. Go to its properties.
    3. Set the modifiers to public.

    By doing this, you'll be able to access the DataSet and its tables from any class without any issues.

    enter image description here