通过数据表填写报表查看器中的组件 [英] Filling in components in Report Viewer through Data Tables

查看:74
本文介绍了通过数据表填写报表查看器中的组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的申请即将完成,但现在有一个问题正在影响我.

收集了客户,发票等的信息之后,我将使用下面的命令填写数据表,这些命令包含在Microsoft Report Viewer的Load事件(包含在Windows窗体中)中:

Hi All,

I am almost finishing my application but now I have a problem that is impacting me.

After collecting the information of clients, invoices, etc, I am filling in Data Tables using commands like the ones bellow, contained in the Load event of the Microsoft Report Viewer (contained in a Windows Form):

DataTable dtInvoiceDetails = new DataTable();

MySqlCommand mscInvoiceDetails = new MySqlCommand("SELECT invoice_code, dt_invoice, total_value, observation FROM tb_invoices WHERE invoice_code = \''" + _invoiceNumber + "\'';", bdConn);

MySqlDataAdapter mscDAmscInvoiceDetails = new MySqlDataAdapter(mscInvoiceDetails);
            mscDAmscInvoiceDetails.Fill(dtInvoiceDetails);



我已经使用工具箱(包括文本框和表格)设计了报表,但是我不知道如何用从数据库检索到的数据表填充这些组件. >
我想知道如何使用正确的DataTable设置组件的来源.

我正在使用Visual Studio Team System-C#

PS:我不是经验丰富的程序员.


提前致谢! :)



I already did the design of my report, using the tool box (included Text Boxes and a Table), but I don''t know how to fill these components with the data I retrieved from the database to the Data Tables.

I would like to know how I can set the source of the components using the properly DataTable.

I am using Visual Studio Team System - C#

PS: I am not an experienced programmer.


Thanks in advance! :)

推荐答案



1.首先从表中填写数据.
MySqlDataAdapter myAdapter = new MySqlDataAdapter("SELECT DeptNo,DName FROM Test.Dept",myConnection);
myAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
DataSet myDataSet =新的DataSet();
myAdapter.Fill(myDataSet,部门");

2.为该水晶报表查看器创建对象.并将数据源分配给Viewer.

这里的报告是Crystal Report的对象.
查看器是Crystal报表查看器的对象.
report.SetDataSource(myDataSet)
Viewer.ReportSource =报告


谢谢...
Hi ,

1.First fill your data from table..
MySqlDataAdapter myAdapter = new MySqlDataAdapter("SELECT DeptNo, DName FROM Test.Dept", myConnection);
myAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
DataSet myDataSet = new DataSet();
myAdapter.Fill(myDataSet,"Departments");

2.Create the Object For that crystal report Viewer. and assign the datasource to tht Viewer.

Here report is the Object of Crystal Report.
Viewer is the Object of Crystal report Viewer.
report.SetDataSource(myDataSet)
Viewer.ReportSource = report


thanks...


这篇关于通过数据表填写报表查看器中的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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