Tuhin Paul
What is the purpose of the ReportDataSource class in the code?
  1. string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\path\\to\\your\\database.accdb";
  2. string query = "SELECT * FROM Customers";
  3. OleDbConnection connection = new OleDbConnection(connectionString);
  4. OleDbDataAdapter adapter = new OleDbDataAdapter(query, connection);
  5. DataSet dataSet = new DataSet();
  6. adapter.Fill(dataSet, "Customers");
  7. ReportDataSource reportDataSource = new ReportDataSource("Customers", dataSet.Tables[0]);
  8. reportViewer1.LocalReport.DataSources.Clear();
  9. reportViewer1.LocalReport.DataSources.Add(reportDataSource);
  10. reportViewer1.RefreshReport();

What is the purpose of the ReportDataSource class in the code?
A) To establish a connection to the database.
B) To retrieve data from the database.
C) To create a dataset to hold the data.
D) To provide data to the report viewer.

By Tuhin Paul in .NET on Apr 15 2023
  • Amit Nagar
    Jun, 2023 27

    D

    • 0
  • Aisha Omar
    May, 2023 15

    option D - To provide data to the report viewer should be the correct option, as the purpose of ReportDataSource is to provide a way to associate the data set with a name like ‘customers’ here that can then be used in report and provide that data to reportviewer control.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS