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
Saqi
NA
63
122.6k
How to dynamically pass Dataset to reportviewer ?
Sep 25 2012 1:40 PM
here is my code
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 Fabrication
{
public partial class MaisVendido : Form
{
DB db = new DB();
DataSet ds = new DataSet();
DataTable dt = new DataTable();
public MaisVendido()
{
InitializeComponent();
Getdataset();
Getdatatable();
}
void Getdataset()
{
ds = db.ClientTable("select * from estoque");
}
void Getdatatable()
{
dt = db.Maisvendendo("select * from estoque");
}
//this is myreportViewer page
private void MaisVendido_Load( object sender, EventArgs e )
{
this.reportViewer1.Reset();
this.reportViewer1.LocalReport.ReportPath = "Report3.rdlc";
ReportDataSource rds = new ReportDataSource("Estoque", dt.TableName);
this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(rds);
this.reportViewer1.LocalReport.Refresh();
}
}
}
public DataTable Maisvendendo( String query )
{
DataTable dt=new DataTable();
DataSet ds=new DataSet();
MySqlConnection con = new MySqlConnection(MysqlConnect());
con.Open();
MySqlDataAdapter ad = new MySqlDataAdapter(query, con);
ad.Fill(ds);
dt.TableName = "Estoque";
dt = ds.Tables[0];
con.Close();
return dt;
}
i already added Report3.rdlc in my application and reportViewer1 now i dont know how to pass dataset into report.
Reply
Answers (
2
)
can we insert two or three controls in one gridview cell
How do I do a get/post for an array in c#?