我想通过给定的给定特定sqlqueries在reportviewer .net4.0中显示报告,请简化我的问题. [英] I want to display report in reportviewer .net4.0 through the given specific sqlqueries that is given.please short out my problem.

查看:60
本文介绍了我想通过给定的给定特定sqlqueries在reportviewer .net4.0中显示报告,请简化我的问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过给定的给定特定sqlqueries在reportviewer .net4.0中显示报告.请简化我的问题.



私人void Generate_Click(object sender,EventArgs e)
{
if(((comboBox1.Text!= null)&&(comboBox2.Text!= null)&&(comboBox3.Text!= null)&&(textBox1.Text!= null))
{




sqlc.Close();
sqlc.Open();

int u = monthsvalue(comboBox1.Text);
int v = monthsvalue(comboBox3.Text);
sqldata = new SqlDataAdapter(从薪水中选择emp_id,month_s,year_s,esi,pf,其中Year_s =""+ comboBox2.Text +"和month_s在""​​+ u +"''和" + v之间+''和emp_id =''" + textBox1.Text +'',sqlc);

DataSet2 ds = new Pay_Roll.DataSet2();
sqldata.Fill(ds,"salary");
rds = new ReportDataSource();

this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(rds);

this.reportViewer1.LocalReport.Refresh();





}

I want to display report in reportviewer .net4.0 through the given specific sqlqueries that is given.please short out my problem.



private void Generate_Click(object sender, EventArgs e)
{
if ((comboBox1.Text!=null) && (comboBox2.Text!=null)&& (comboBox3.Text!=null) && (textBox1.Text!=null))
{




sqlc.Close();
sqlc.Open();

int u = monthsvalue(comboBox1.Text);
int v = monthsvalue(comboBox3.Text);
sqldata = new SqlDataAdapter("select emp_id,month_s,year_s,esi,pf from salary where Year_s=''" + comboBox2.Text + "'' and month_s between ''" + u + "'' and ''" + v + "'' and emp_id=''" + textBox1.Text + "''",sqlc);

DataSet2 ds = new Pay_Roll.DataSet2();
sqldata.Fill(ds, "salary");
rds = new ReportDataSource();

this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(rds);

this.reportViewer1.LocalReport.Refresh();





}

推荐答案

修改此行
rds = new ReportDataSource();
通过以下行
ReportDataSource rds =新的ReportDataSource("salary",ds);

或有关如何将ReportViewer动态分配给.rdlc的更多详细信息
http://social.msdn.microsoft.com/Forums/zh/vsreportcontrols/thread/c6524b68-bdfd-4f10-848f-355bc9445323 [
Modify this line
rds = new ReportDataSource();
by the following line
ReportDataSource rds = new ReportDataSource("salary", ds);

Or for more details on How to dynamically assign ReportViewer to .rdlc
http://social.msdn.microsoft.com/Forums/en/vsreportcontrols/thread/c6524b68-bdfd-4f10-848f-355bc9445323[^]


这篇关于我想通过给定的给定特定sqlqueries在reportviewer .net4.0中显示报告,请简化我的问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆