Christian Nwamba

Christian Nwamba

  • NA
  • 234
  • 73.3k

Please what is wrong with this litlle piece of code

Aug 10 2013 7:16 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

namespace rptplay
{
    public partial class Form1 : Form
    {
        DataClasses1DataContext dc = new DataClasses1DataContext();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            DataSet1.AuthorsDataTable dt = new DataSet1.AuthorsDataTable();

            var query = from a in dc.Authors select a;

            foreach (Author a in query){

                dt.Rows.Add(a.a_id, a.authours_name, a.gender);
            }

            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));



            this.reportViewer1.RefreshReport();
        }
    }
}


The striked code was underlined red in my code and marked error.

This was the error thrown:

Error    1    The call is ambiguous between the following methods or properties: 'Microsoft.Reporting.WinForms.ReportDataSource.ReportDataSource(string, System.Collections.IEnumerable)' and 'Microsoft.Reporting.WinForms.ReportDataSource.ReportDataSource(string, System.Data.DataTable)'    C:\Users\chris\documents\visual studio 2010\Projects\caritas\caritas\reportTst.cs    33    60    caritas

Please help me correct it.
Thanks

Answers (17)