Adding a column to a DataSet (xsd) for Crystal Report

I am working on a report and I need to add a column to one of my datasets and to the RPT file, but when I try to change the dataset, I get an error that the specified table does not exist. When I look in the code, it looks like the table used for this purpose was originally used, but this approach was canceled, and now it is done using the DataSet in the code that is attached to the report.

My problem is that I need to add this new column to the report, and I cannot force the data to be processed in such a way that I can drag the new field into the report, because I cannot find the necessary fragment of the DataSet, because it does not exist, as he did earlier, and now in the DataSet code he takes a place.

Can anyone point me in the right direction how to do this?

UPDATE: This is about how my dataset gets into the Crystal Report.

private Sub ShowReport() Dim dsStatsForPlanned As DataSet = Nothing dsStatsForPlanned = DirectCast(Session(CreateSessionKey()), DataSet) plannedProductRpt.SetDataSource(dsStatsForPlanned) End Sub 

I added an additional field that I need in the DataSet included in Session, but I try to use Designer to get this additional field in the report, and when I try to update or change the data source, Designer reports that the table does not exist, apparently because that this table exists only in memory and does not bind directly to the SQL table.

+4
source share
2 answers

After several days of digging and searching a lot of information that was not useful, I finally managed to find the answer to my problem in a message from 2006 here:

http://sstjean.blogspot.com/2006/12/xsdexe-and-msdatasetgenerator-operate.html

What I did to fix my problem:

  • Manually edit the XSD file in a text editor and add the columns I need. This made them appear in my XSD when viewed in Visual Studio.
  • Run the specified user tool for the XSD to regenerate the DataSet. In my case, it was MSDataSetGenerator. This was indicated on the Properties tab in VS, and I could right-click on the XSD in Solution Explorer and select Run Custom Tool.
  • Open my RPT file and run Verify Databse. This one finally indicated that the database had changed, and it had updated the report, and now I saw my new field in the report designer.
+3
source

My approach would be to actually modify data outside of Crystal. Therefore, whether changing your request or updating .xsd, you must add your column there. Then in Crystal Reports, you will go to “Database” on the menu bar and select “Check Database” if your data source / location has not changed, or “Set Data Source Location” if there is one. After checking the data source again, your new column should appear in the fields of the database, and you can drag it into your report.

0
source

Source: https://habr.com/ru/post/1399893/


All Articles