我想打印dgv上的内容,.因为dgv上的内容通过查询,得到了一定的数据,不需要打印全部.我不想直接打印dgv,我想通过MicrosoftReportview微软报表在报表中动态的显示,而且要代码绑定报表的 ,dgv在一个窗体,报表在另一个窗体,当我单击dgv中的报表按钮就可以实现我说的功能,希望大侠们谁有示例代码,给我参考参考,小弟感激不尽,小第刚刚接触c#,希望大侠们帮帮忙!!先谢谢了!!
解决方案 »
- 新手关于C#的简单问题!送分!
- 用tcp/ip协议进行的网络传输文件,发送端窗体和接收端窗体是同一个解决方案中的两个项目呢,还是同一个项目中的两个窗体呢?如果是在不同
- 请教c#中枚举类型的用法/
- dll中如何操作mdiform實例?
- 关于自动识别图像上的数字技术,并且显示出来,有什么好的建议?
- 请问,如何给动态生成到窗体中的PictureBox添加单击事件?
- 請各位指點一下小弟,怎么樣才可以使comboBox1 的選擇項為只可以選不可以讓用戶填入呀??(C# winform)
- ftp文件下载
- 如何更换文件.exe图 标?
- C#和C++的不同体现在哪些地方??
- tabpage控件怎么让其他的都禁用
- 高手帮忙!!!
看看这个http://www.blue1000.com/bkhtml/2010-08/68611.htm
有问题留言,就不敲代码了。
private void Form2_Load(object sender, EventArgs e)
{
String strConnection = "Data Source=.;Initial Catalog=职工信息;Integrated Security=True";
SqlConnection con = new SqlConnection(strConnection);
String strSQL = "SELECT * FROM TABLE1";
SqlDataAdapter da = new SqlDataAdapter(strSQL, con);
//con.Open();
DataSet ds = new DataSet();
da.Fill(ds);
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = ds;
//reportViewer1.LocalReport.ReportPath = MapPath(Report1.rdlc);
Microsoft.Reporting.WinForms.ReportDataSource rds = new Microsoft.Reporting.WinForms.ReportDataSource("职工信息DataSet_TABLE1", ds.Tables["TABLE1"]);
rds.Value = bindingSource; // this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.DataSources.Add(rds);
this.reportViewer1.LocalReport.ReportEmbeddedResource = "WindowsFormsApplication1.Report1.rdlc";
this.reportViewer1.RefreshReport();
//con.Close()
这是我调试的一段代码 ,但是在报表的窗体中,却有本地报表处理期间出错,尚未为数据源"职工信息DataSet_TABLE1",提供数据,没有显示数据,你能帮我看看是什么错误吗?那里代码写的有问题,或者需要加入什么代码吗?