TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Christian Nwamba
NA
234
75.2k
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
Reply
Answers (
17
)
Crystal Report and Linq
Formatting Datetime in ReportViewer Chart to Show Only Date