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(
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


Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted Aug 10, 2013, 4:00 AM EDT
this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1",(DataTable) dt));
Christian NwambaRank #8,005 · 230 reputationPosted Aug 10, 2013, 4:39 AM EDT
Thank Sir
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 10, 2013, 5:42 AM EDT
You need to define the rdlc path to the localreport. Please refer
Regards,
Iftikar
Christian NwambaRank #8,005 · 230 reputationPosted Aug 10, 2013, 8:02 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 10, 2013, 8:16 AM EDT
Regards,
Iftikar
Christian NwambaRank #8,005 · 230 reputationPosted Aug 10, 2013, 8:44 AM EDT
Please I appreciate your help but I pull me through.
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 10, 2013, 9:36 AM EDT
Regards,
Iftikar
Christian NwambaRank #8,005 · 230 reputationPosted Aug 10, 2013, 8:26 PM EDT
Thanks
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 10, 2013, 9:06 PM EDT
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);
}
Regards,
Iftikar
Christian NwambaRank #8,005 · 230 reputationPosted Aug 11, 2013, 1:27 AM EDT
Thanks for your help
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 11, 2013, 6:28 AM EDT
Regards,
Iftikar
Christian NwambaRank #8,005 · 230 reputationPosted Aug 13, 2013, 11:10 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 13, 2013, 7:55 PM EDT
Regards,
Iftikar
Christian NwambaRank #8,005 · 230 reputationPosted Aug 23, 2013, 3:31 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 23, 2013, 3:34 AM EDT
Christian NwambaRank #8,005 · 230 reputationPosted Aug 23, 2013, 3:49 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 23, 2013, 4:12 AM EDT
http://msdn.microsoft.com/en-us/library/windows/hardware/hh439318(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/15d1wtaf(v=vs.90).aspx