Click here to Skip to main content
15,895,656 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi all,

I've got 5 DataTables being initialized and filled in the reportviewer1_Load method, contained in a Windows Form FReport.

DataTable dtInvoiceDetails = new DataTable();
DataTable dtInvoiceDescriptionDetails = new DataTable();
DataTable dtClientDetails = new DataTable();
DataTable dtPaymentTypeDetails = new DataTable();
DataTable dtDocumentTypeDetails = new DataTable();

MySqlCommand mscInvoiceDetails = new MySqlCommand("SELECT invoice_code, dt_invoice, total_value, observation FROM tb_invoices WHERE invoice_code = \'" + _invoiceNumber + "\';", bdConn);
MySqlCommand mscInvoiceDescriptionDetails = new MySqlCommand("SELECT detail_description, detail_value, ind_taxible FROM tb_doc_details WHERE tb_invoices_id_invoice = (SELECT id_invoice FROM tb_invoices WHERE invoice_code = \'" + _invoiceNumber + "\');", bdConn);
MySqlCommand mscClientDetails = new MySqlCommand("SELECT company_name, company_registration, address, corporate_name FROM tb_client WHERE id = (SELECT tb_client_id FROM tb_invoices WHERE invoice_code = \'" + _invoiceNumber + "\');", bdConn);
MySqlCommand mscPaymentTypeDetails = new MySqlCommand("SELECT payment_type_name, payment_type_description FROM tb_payment_type WHERE id = (SELECT tb_payment_type_id FROM tb_invoices WHERE invoice_code = \'" + _invoiceNumber + "\');", bdConn);
MySqlCommand mscDocumentTypeDetails = new MySqlCommand("SELECT doc_type_cd FROM tb_doc_type WHERE id_doc_type = (SELECT tb_doc_type_id_doc_type FROM tb_invoices WHERE invoice_code = \'" + _invoiceNumber + "\');", bdConn);

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

MySqlDataAdapter mscDAdtInvoiceDescriptionDetails = new MySqlDataAdapter(mscInvoiceDescriptionDetails);
mscDAdtInvoiceDescriptionDetails.Fill(dtInvoiceDescriptionDetails);

MySqlDataAdapter mscDAdtClientDetails = new MySqlDataAdapter(mscClientDetails);
mscDAdtClientDetails.Fill(dtClientDetails);

MySqlDataAdapter mscDAdtPaymentTypeDetails = new MySqlDataAdapter(mscPaymentTypeDetails);
mscDAdtPaymentTypeDetails.Fill(dtPaymentTypeDetails);

MySqlDataAdapter mscDAdtDocumentTypeDetails = new MySqlDataAdapter(mscDocumentTypeDetails);
mscDAdtDocumentTypeDetails.Fill(dtDocumentTypeDetails);


I created a Microsoft Report Viewer, named reportViewer1, inside a windows Form named RepF, that contain a report named Report1.rdlc.

Inside this reportViewer1 code, in private void reportViewer1_Load(object sender, EventArgs e) { ... } is the code posted above which creates the DataTables and fill them.

In my report (Report1.rdlc), I have some fields like 4 Text Boxes, which will contain data stored in 4 DataTables, and 1 Table, which will contains data stored in 1 of the 5 DataTables.

what I don't know is: How can I make these fields in my Report1.rdlc, show the information I collected in those initializes and full DataTables?

I need to print the data contained in those DataTables through a Microsoft Report Viewer report, in my case, Report1.rdlc. This report is already configured with the properly design. I just need to feed them.

PS: I am not using a DataSet. I only have those 5 DataTables. If it is really necessary to use a DataSet, how can I create a DataSet and Include those 5 DataTables into it

Thanks in advance! :)
Posted
Updated 4-Nov-10 20:27pm
v13
Comments
Sunasara Imdadhusen 4-Nov-10 3:02am    
Not clear!
lucasgrohl 4-Nov-10 5:09am    
Now I think this is more clear =)
shakil0304003 4-Nov-10 11:08am    
Not clear!!!
lucasgrohl 4-Nov-10 13:06pm    
PS: I am not using a DataSet. I only have those 5 DataTables. If it is really necessary to use a DataSet, how can I create a DataSet and Include those 5 DataTables into it?

Thanks!

1 solution

Seems the following SO thread is on the same topic:

http://stackoverflow.com/questions/1815199/c-microsoft-report-from-datatable-object[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900