Updating Crystal Reports .NET if You Change the XSD

One method of creating Crystal Reports is to use an ADO.NET Dataset (for good advice please read Reporting Off ADO.NET Datasets).  To create the report from a dataset, you have to model the dataset in an XML Schema Document, which has the .XSD extension.  You use the XSD as the ‘source’ of your report at design time, and at runtime, set the data source to the ADO.NET dataset in memory.

From time to time, requirements for your reports change, and you have to change the dataset.  If you used an XSD to design your report, you need to follow these steps to update your report:

1) Update your XSD.  Either make the changes manually, or re-create the entire document, whichever is easier.
2) Open your report in design view in VS .NET.
3) Open the Field Explorer, and right-click on “Database Fields”.
4) Choose “Set Location…” from the menu.
5) Choose the data source you wish to update in the “Current Data Source” dropdownlist.  You can choose either the entire dataset, or just a single table (in many cases, there will only be one table per dataset, so either choice is as good as the other in this case).
6) In the “Replace with” window, expand “More Data Sources”, then “ADO.NET (XML)”.
7) Double-click “Make New Connection”.  You may see your dataset listed, however, I have found from experience that sometimes you need to overwrite the cached version.
8) In the new window, browse to your XSD and choose “Finish”.  Leave “Use Visual Studio Data Class” unchecked.
9) If you have a table chosen in the “Current Data Source” dropdownlist, highlight the replacement table you just added, and click “Replace”.  If you have a dataset chosen, highlight the replacement dataset and click “Replace”.  If the “Replace” button is not activated, you need to make sure you have the correct structure chosen in both places.
10) Click “Close”.  You may be asked to remap fields if any field changed its data type.  To map the fields, un-check “match type”, and match fields one by one, clicking “Map” after each selection.  Do this until all the fields that need to be re-mapped have been re-mapped.
11) You should now see all yoru changes reflected in the Fields Viewer (you may have to expand “Database Fields”).

One thought on “Updating Crystal Reports .NET if You Change the XSD”

  1. wow. thanks for posting this, exactly what i was looking for. it amazes me how much crystal sucks…11 steps for it to see changes to an xsd.

Comments are closed.