本文介绍了如何通过Web应用程序中的存储过程在报表查看器中进行报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI,
i希望通过报表查看器控件进行报表,并且我创建了名为'usp_FetchAllEmp'的存储过程。它具有where条件。(如Id = @ id)但我不明白如何绑定报表数据源,最后如何在报表查看器控件中显示所有数据。
任何人都可以提供给我的代码片段,以便我可以尝试并解决我的问题。
plz帮助我..
i want to make a report through report viewer control and i have made stored procedure with the name 'usp_FetchAllEmp". it has where condition.(like Id=@id) but i am not getting understand that how to bind with report data source and finally how to show all the data in report viewer control.
can anyone provide me code snippet for that so that i could tried that and resolve my issue.
plz help me..
推荐答案
string selection;
string sqlQry;
ReportDataSource sReportDataSource = new ReportDataSource();
MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["LocalMySqlServer"].ConnectionString);
public void viewreports()
{
this.ReportViewer1.Reset();
sReportDataSource.Name = "dsscpreport_dtscpreport";
sReportDataSource.Value = objImportBal.GetReportData(sqlQry, con);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(sReportDataSource);
ReportViewer1.LocalReport.ReportPath = "Reports/Sales_Reports/Sales_Transaction/rdlcsalesregister.rdlc";
ReportViewer1.LocalReport.Refresh();
}
public DataTable GetReportData(string Query,MySqlConnection con)
{
MySqlDataAdapter adp = new MySqlDataAdapter(Query, con);
DataSet ds = new DataSet();
adp.Fill(ds);
return ds.Tables[0];
}
此处取代查询U必须调用存储过程并填充数据表
here Instead Of Query U Have To Call Stored Procedure And Fill The Datatable
这篇关于如何通过Web应用程序中的存储过程在报表查看器中进行报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!