问题
I'm creating a report using the built-in module of Crystal Reports in Visual Studio 2008, and for that I have added a DataSet containing multiple DataTables. As for now, the DataTables have a certain quantity of fields which may grow in the future, so the next person updating my report will need to update the DataSet schema.
The problem is that whenever I add new fields to a Datatable, that Datatable's fields isn't updated in Crystal Reports. Every time I tried doing this I was forced to remove the DataSet completely and add it again in order to have the updated schema, which is a very bad solution because all fields already on the reports get lost.
Is there a simple way to make it update the structure? (I've already clicked Verify Database under database Expert).
回答1:
After having a conversation with a friend, we both figured out how to overcome this problem but the solution is not very elegant:
- Add columns to your
DataTable
- Close Visual Studio
- re-open Visual Studio
- right click the
DataTable
to update - click
Set Datasource Location
- add your
DataSet
connection again and update yourDataTable
against the one present in the new connection
Note: if you try to update again, you must close visual studio again and repeat everything.
Hope this can help someone with the same problem.
来源:https://stackoverflow.com/questions/4959814/update-dataset-schema-on-crystal-reports-for-vs2008