简体   繁体   中英

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?

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.

In the Report Data window, do you see a "Datasets" section? Try refreshing these datasets. Also make sure the sources are binded properly and with the right name.

I usually delete the xsd file containing the dataset and recreated it from scratch. Then you can refresh ReportData panel to see the new column.

I went through the same problem.

I managed to settle with the following process: In your project locate the file ".xsd" which makes reference to the whole of Data used in the report (DataSource).

After finding this aquivo in your solcution open the way designer by double-clicking this.

This file is your data source it can contain your queries, tables, procedures, search for your query related to the report you want to update (DataSet) with a click of the right mouse button select the "Configure ..." option in the next resulting window select your query fields should appear on the block forward, then it is just click the finish.

Recalling that made this process with storage procedures, and this was already updated in my database.

Not sure if this is on the right track, but I know that when using a .dbml designer to connect with a database, when I change the schema of an object in the DB, I have to refresh the server browser, drop the object on design surface and re-add the object to the design surface. It doesn't automatically update the schema in the dbml.

1. Delete all contents and folder from your project BIN and Obj folder

  1. Reopen your visual studio as well as your project.

  2. Then press Ctrl + Alt + D to open Report Data Window

  3. Expanding Data Source Refresh your desired one

  4. Expanding Data set Refresh your desired one

It is ok now. Happy Coding.

转到属性,新选择源类

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM