Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh fields in Dataset in ReportViewer

I have a WinForms application, written in VS2012. It sources data from a View on my SQL Server database. I added a new column to my view, but, can't find a way to get the ReportViewer dataset to see the new column.

In the ReportData panel, I have attempted:

Right Click data source, and click Refresh. Right Click data set, and click Refresh

Both do not get the new column to show in the list of available columns.

How do I get the column to show in my report designer within VS2012?

like image 967
Craig Avatar asked Feb 15 '23 23:02

Craig


1 Answers

Since I just had the same problem and none of the suggested answers helped...

You can add the field in XML as well. Right click on the report and chose Open with..., select XML (Text)-Editor. Now look for the tag <DataSets> and add a new <Field> inside the <Fields> branch. For example, you just added the column Test to your DataSet, which previously contained FieldName1 and FieldName2. You can edit the XML as such:

<DataSets>
  <DataSet Name="YourDataSet">
    <Fields>
      <Field Name="FieldName1">
       <DataField>FieldName1</DataField>
       <rd:TypeName>System.YourType</rd:TypeName>
      </Field>
      <Field Name="FieldName2">
       <DataField>FieldName2</DataField>
       <rd:TypeName>System.YourType</rd:TypeName>
      </Field>
      <Field Name="Test">
       <DataField>Test</DataField>
       <rd:TypeName>System.YourType</rd:TypeName>
      </Field>
    </Fields>
  </DataSet>
</DataSets>

Now save the XML and open it again in the report designer. You now should be able to select your new field and add it to the report.

like image 194
waka Avatar answered Feb 18 '23 13:02

waka