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

I am having a problem when I feed my Report Viewer using a DataSet.

I have a DataTable that is filling in some text boxes in my Microsoft Report Viewer.

Some fields are null.

When I execute the program, most of the fields are filled but some doesn't appear.

When I check the Output this what I get:


Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘invoice_date’. This field is missing from the returned result set from the data source. (rsMissingFieldInDataSet)
Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘invoice_date’. The data extension returned an error during reading the field. There is no data for the field at position 9. (rsErrorReadingDataSetField)
Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘payment_location_detail’. This field is missing from the returned result set from the data source. (rsMissingFieldInDataSet)
Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘payment_location_detail’. The data extension returned an error during reading the field. There is no data for the field at position 13. (rsErrorReadingDataSetField)
Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘comp_address’. This field is missing from the returned result set from the data source. (rsMissingFieldInDataSet)
Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘comp_address’. The data extension returned an error during reading the field. There is no data for the field at position 14. (rsErrorReadingDataSetField)
Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘company_name_generator’. This field is missing from the returned result set from the data source. (rsMissingFieldInDataSet)
Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘company_name_generator’. The data extension returned an error during reading the field. There is no data for the field at position 15. (rsErrorReadingDataSetField)
Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘company_address_generator’. This field is missing from the returned result set from the data source. (rsMissingFieldInDataSet)
Warning: The data set ‘DataSet2_DataTable1’ contains a definition for the Field ‘company_address_generator’. The data extension returned an error during reading the field. There is no data for the field at position 16. (rsErrorReadingDataSetField)
Warning: The Value expression for the textbox ‘company_name_generator’ contains an error: Object reference not set to an instance of an object. (rsRuntimeErrorInExpression)
The thread 0x176c has exited with code 0 (0x0).
The thread 0x44c has exited with code 0 (0x0).
The thread 0x1408 has exited with code 0 (0x0).
The thread 0x450 has exited with code 0 (0x0).


I checked my code and it is returning those fields. Only 2 columns of this 1 row are null - (but they are null because they are supposed to be null, not because they are not being retrieved).

In resume, all the fields are being retrieved but not all are being displayed in my Report.

Maybe I have to update the dataset, some refresh, I don't know... if yes, how can I do it? Is there any button to do it?

Can you help me to solve it?

Thanks in advance!
Posted
Updated 21-Nov-10 22:29pm
v4
Comments
Sandeep Mewara 22-Nov-10 4:14am    
Error clearly states that the fields are missing at the time of execution.
In BIDS, run the query for that dataset and see what is being returned.
lucasgrohl 22-Nov-10 4:25am    
My databatle is being filled through code:

MySqlCommand mscGeneralInvoiceData = new MySqlCommand("SELECT tb_c.company_name, tb_c.corporate_name, tb_c.company_registration, tb_c.address, tb_dt.doc_type_cd, tb_pt.payment_type_name, tb_pt.payment_type_description, tb_i.invoice_code, tb_i.dt_invoice, tb_i.total_value, tb_i.observation, tb_i.tax_percent, tb_cd.company_name, tb_cd.company_address FROM tb_client AS tb_c INNER JOIN tb_invoices AS tb_i ON tb_c.id = tb_i.tb_client_id INNER JOIN tb_doc_type AS tb_dt ON id_doc_type = tb_i.tb_doc_type_id_doc_type INNER JOIN tb_payment_type AS tb_pt ON tb_pt.id = tb_i.tb_payment_type_id INNER JOIN tb_company_detail AS tb_cd ON tb_i.tb_company_detail_id = tb_cd.id WHERE invoice_code = \'" + _invoiceNumber + "\';", bdConn);

MySqlDataAdapter mscDAdtGeneralInvoiceData = new MySqlDataAdapter(mscGeneralInvoiceData);
mscDAdtGeneralInvoiceData.Fill(dtGeneralInvoiceData);

reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2_DataTable1", dtGeneralInvoiceData));

When I debug I see that all the fields are filled. But some of them doesn't appear on the report. Although all the other are ok.

1 solution

in the select statement use coalesce() per field

this way you return something like

Select Coalesce(DateOfBirth, 'N/A')

'N/A' is a valid string datatype and not null.
 
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