visual-studio 如何在报表中添加字段(Visual Studio 中的 Crystal Reports)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1401314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I add a field in to a report (Crystal Reports in Visual Studio)
提问by BIBD
I have an existing report (Crystal Report) in my Visual Studio project that is based off of an SQL Server View. using an OLE DB (ADO) connection.
我的 Visual Studio 项目中有一个基于 SQL Server 视图的现有报告(Crystal Report)。使用 OLE DB (ADO) 连接。
I've updated the View since the report was created. I've changed some field names and added a field.
自创建报告以来,我已经更新了视图。我更改了一些字段名称并添加了一个字段。
How can I update the fields on the report to point at the new field names in the view?
如何更新报告上的字段以指向视图中的新字段名称?
OR
或者
How can I add a new field to the report that points at the new field in the view?
如何向报表中添加指向视图中新字段的新字段?
(I know, that's two questions. But the answer is probably going to be very similar for both)
(我知道,这是两个问题。但两者的答案可能非常相似)
回答by BIBD
I finally figured it out. For the sake of the next guy...
我终于弄明白了。为了下一个男人...
shahkalpesh and serge_ bg are right about the "Verify Data"
If you right click on a blank spot on your report, you will get a popup menu. Select Database -> Verify__Database. Crystal Reports should update the fields that have changed.You can drag-n-drop the new field onto your report.
There should be a "Field Explorer" tree view (probably on the left). Select Database Fields -> View/Table Name -> Field Name and drag that onto your report.
shahkalpesh 和 serge_bg 关于“验证数据”是正确的
如果您右键单击报告上的空白点,您将看到一个弹出菜单。选择数据库 -> 验证__数据库。Crystal Reports 应更新已更改的字段。您可以将新字段拖放到您的报告中。
应该有一个“字段资源管理器”树视图(可能在左侧)。选择 Database Fields -> View/Table Name -> Field Name 并将其拖到您的报告中。
A worst case scenario of Crystal Reports updating report field to match up with the wrong field on the view, can be resolved by deleting the old field and re-adding the field using the drag and drop method.
Crystal Reports 更新报表字段以匹配视图上错误字段的最坏情况可以通过删除旧字段并使用拖放方法重新添加字段来解决。
回答by Serge Bogatyrev
"Verify database" should help you. This is the answer on both questions.
“验证数据库”应该可以帮助您。这是两个问题的答案。
回答by shahkalpesh
How can I add a new field to the report that points at the new field in the view?
You will have to manually add that field to the report. What do you think should be the case?
如何向报表中添加指向视图中新字段的新字段?
您必须手动将该字段添加到报告中。你认为应该是什么情况?
I think there is some option which sounds like "Verify Data". If you do that, it will prompt you with "some fields has changed... proceed to fix report?", I think that should take care of your first question.
我认为有一些选项听起来像“验证数据”。如果您这样做,它会提示您“某些字段已更改...继续修复报告?”,我认为这应该解决您的第一个问题。
回答by can.do
Thanks to the geniuses at Microsoft who promptly thought that it might be possible to change tables and view columns, this is a piece of cake! You get that I'm being sarcastic I hope.
多亏了微软的天才们,他们及时想到了可以改变表和视图列,这是小菜一碟!你知道我在讽刺我希望。
You're missing 1 step, that's to drop and recreate your DataAdapterotherwise you'll go nuts trying to add the new fields into your report... then you can run the verify dboption to refresh your columns...
你错过了 1 步,那就是删除并重新创建你的,DataAdapter否则你会疯狂地尝试将新字段添加到你的报告中......然后你可以运行验证数据库选项来刷新你的列......
回答by Narendra Sharma
Add the field to the dataset/datatable, based upon the info of the underlying data model Now update the report data source in the crystal report designer Then update the report in the report design to add the field
根据底层数据模型的信息将字段添加到数据集/数据表中 现在在水晶报表设计器中更新报表数据源 然后在报表设计中更新报表以添加字段

