向Crystal报表的DataSet(xsd)添加列 [英] Adding a column to a DataSet (xsd) for a Crystal Report

查看:299
本文介绍了向Crystal报表的DataSet(xsd)添加列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个报表,并需要添加一列到我的数据集和RPT文件,但当我尝试修改数据集,我得到一个错误,指定的表不存在。当我看代码,它看起来像是最初有一个表用于这个目的,但这种方法已被放弃,现在这是代替在一个DataSet在附加到报告的代码。



我的问题是,我需要在报表中添加这个新列,我似乎不能得到一个处理数据的方式,所以我可以拖动我的新字段到报表上,因为我找不到所需的DataSet块,因为它不像以前那样存在,而且DataSet现在占据了它的位置。


$ b $

$ b这是大约我的数据集如何到达Crystal Report

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

我已经在Session中添加了DataSet中需要的附加字段,但是我想使用Designer来将这个额外的字段添加到报表中,我尝试refrechch或更改数据源,设计器告诉我表不存在,可能是因为这个表只存在于内存,并不直接回到一个SQL表。

解决方案

经过几天的挖掘,找到了很多没有帮助的信息,我终于设法找到了我的问题的答案从2006年的一个职位:



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



我用来解决问题的方法:




  • 在文本编辑器中手动编辑XSD文件,并添加所需的列。这使得它们在Visual Studio中查看时显示在我的XSD中。

  • 运行指定的自定义工具为XSD重新生成DataSet。在我的case是MSDataSetGenerator。这在VS中的属性选项卡上列出,我可以右键单击解决方案资源管理器中的XSD,然后选择运行自定义工具。

  • 打开我的RPT文件并运行Verify Databse。此最后表示数据库已更改,正在更新报表,我现在在报表设计器中看到了我的新字段。


I am working on a report and need to add a column to one of my datasets and to the RPT file, but when I try to modify the Data Set, I get an error that the specified table doesn't exist. When I look in the code, it looks like there was originally a table used for this purpose, but this approach has been abandoned, and now this is instead being done with a DataSet in code that is attached to the report.

My problem is that I need to add this new column in the report and I can't seem to get a handle on the data in a way so I can drag my new field onto the report, because I can't find the needed piece of the DataSet because it doesn't exist as it previously did, and the in code DataSet now takes it's place.

Anyone out there able to point me in the right direction for how to go about making this work?

UPDATE: This is roughly how my data set gets to the Crystal Report

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

I have added the additional field that I need in the DataSet that comes in from Session, but am trying to use Designer to get this extra field onto the report, and when I try to refrech or change the Data Source, Designer tells me that the table doesn't exist, presumably because this table exists only in memory, and doesn't tie directly back to a SQL table.

解决方案

After several days of digging, and finding a lot of information that was not helpful, I finally managed to find the answer to my issue in a post 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 that I needed. This made them appear in my XSD when viewed within Visual Studio.
  • Run the specified Custom Tool for the XSD to regenerate the DataSet. In my case it was the MSDataSetGenerator. This was listed 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 finally indicated that the database had changed and it was updating the report, and I now saw my new field in the Report Designer.

这篇关于向Crystal报表的DataSet(xsd)添加列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆