如何将Crystal Reports指向新数据库 [英] How do I point Crystal Reports at a new database

查看:185
本文介绍了如何将Crystal Reports指向新数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Crystal Reports 2008用户,有超过100个自定义开发的报告。
报告所有查询SQL Server数据库(SQL 2005)。

此数据库服务器正在替换为新系统(运行SQL 2008 R2),现有数据库将移动到新服务器。
新的数据库服务器将有一个不同的名称(我可以通过Crystal Reports Connections访问),
然而,其中一个应用程序也在同时升级。将在新服务器上还原旧数据库(DB_A)以进行历史报告,并将创建新数据库(DB_B)。
新的DB_B将有一个非常相似的模式,所以我希望大多数Crystal Reports应该能够针对新的DB_B运行,只需要很少或没有修改,除了在新的DB_B指向报告定义。

I have a Crystal Reports 2008 user that has over 100 custom developed reports. The reports all query Sql Server databases (SQL 2005).
This database server is getting replaced with a new system (running SQL 2008 R2) and the existing databases will be moved to the new server. The new database server will have a different name (which I can address via the Crystal Reports Connections), however, one of the applications is also being upgraded at the same time. The old database (DB_A) will be restored on the new server for historical reporting and a new database (DB_B) will be created. The new DB_B will have a very similar schema, so I would expect that most of the Crystal Reports should be able to run against the new DB_B with little or no modification other than pointing the report definition at the new DB_B.

当然,我的大多数用户定制开发的报表查询DB_A。

Of course, the majority of my users custom developed reports query against DB_A.

我的问题是:我修改现有的Crystal Reports文件以指向新数据库名称(DB_B)而不是旧数据库(DB_A)?

My question is: How do I modify existing Crystal Reports files to point at the new database name (DB_B) instead of the old database (DB_A) ?

推荐答案

使用数据库菜单和设置数据源位置菜单选项更改报表中每个表的名称或位置。

Use the Database menu and "Set Datasource Location" menu option to change the name or location of each table in a report.

这适用于更改数据库的位置,更改为新的数据库,更改报表中使用的单个表的位置或名称。

This works for changing the location of a database, changing to a new database, and changing the location or name of an individual table being used in your report.

要更改数据源连接,请转到数据库菜单,然后单击设置数据源位置。

To change the datasource connection, go the Database menu and click Set Datasource Location.


  1. 更改数据源连接:
  1. Change the Datasource Connection:

  1. 从当前数据源列表(顶部框)中,单击要更改的数据源连接。

  2. 在替换为列表(底部框)中,单击新的数据源连接。 / li>
  3. 点击更新。


  • 更改单个表:

  • Change Individual Tables:


    1. 从当前数据源列表(顶部框)中,展开要更改的数据源连接。

    2. 查找要为其更新位置或名称。

    3. 在替换为列表(底部框)中,展开新的数据源连接。

    4. 查找新表

    5. 请注意,如果表名称已更改,旧表名仍会显示在Field Explorer,即使它现在正在使用新表。 (您可以确认这是在设置数据源位置中的当前数据源中查看表格属性的表名称。屏幕截图 http:// i .imgur.com / gzGYVTZ.png )可以从数据库专家 - >所选表格中的上下文菜单中将旧表格名称重命名为新名称。

    1. From the Current Data Source list (the top box), expand the datasource connection that you want to change.
    2. Find the table for which you want to update the location or name.
    3. In the Replace with list (the bottom box), expand the new datasource connection.
    4. Find the new table you want to update to point to.
    5. Click Update.
    6. Note that if the table name has changed, the old table name will still appear in the Field Explorer even though it is now using the new table. (You can confirm this be looking at the Table Name of the table's properties in Current Data Source in Set Datasource Location. Screenshot http://i.imgur.com/gzGYVTZ.png) It's possible to rename the old table name to the new name from the context menu in Database Expert -> Selected Tables.


  • 更改子报表:

  • Change Subreports:


    1. 对您可能已嵌入报表中的任何子报表重复上述步骤。 / li>
    2. 关闭设置数据源位置窗口。


  • 任何命令或SQL表达式:

  • Any Commands or SQL Expressions:


    1. 转到数据库菜单并单击数据库专家。

    2. 如果报表设计器使用添加命令

    3. 右键单击该命令,然后选择编辑命令。

    4. 检查该SQL是否为指定特定数据库。

    5. 关闭数据库专家窗口。

    6. 在右侧的字段资源管理器窗格中,右键单击任何SQL表达式。

    7. 检查SQL Expressions是否指定了特定数据库。

    1. Go to the Database menu and click Database Expert.
    2. If the report designer used "Add Command" to write custom SQL it will be shown in the Selected Tables box on the right.
    3. Right click that command and choose "Edit Command".
    4. Check if that SQL is specifying a specific database. If so you might need to change it.
    5. Close the Database Expert window.
    6. In the Field Explorer pane on the right, right click any SQL Expressions.
    7. Check if the SQL Expressions are specifying a specific database. If so you might need to change it also.
    8. Save and close your Formula Editor window when you're done editing.


  • >

    尝试再次运行报表。

    关键是更改数据源连接首先,然后任何表需要更新,然后其他的东西。连接不会自动更改下面的表。这些表就像在他们看到的第一只大鹅似的动物上印有的小鹅。他们会继续绕过所有原因和逻辑,并转到他们一直走到哪里,除非您特别手动更改它们。

    The key is to change the datasource connection first, then any tables you need to update, then the other stuff. The connection won't automatically change the tables underneath. Those tables are like goslings that've imprinted on the first large goose-like animal they see. They'll continue to bypass all reason and logic and go to where they've always gone unless you specifically manually change them.

    为了更方便,这里是一个提示:您可以在数据库菜单中显示SQL查询,您将看到直接访问特定数据库的任何表的数据库限定的表名(如Sales,dbo,Customers)。这可能使狩猎更容易,如果你有很多东西。当我处理这个问题,我不得不改变每一个表指向新数据库中的新表。

    To make it more convenient, here's a tip: You can "Show SQL Query" in the Database menu, and you'll see table names qualified with the database (like "Sales"."dbo"."Customers") for any tables that go straight to a specific database. That might make the hunting easier if you have a lot of stuff going on. When I tackled this problem I had to change each and every table to point to the new table in the new database.

    这篇关于如何将Crystal Reports指向新数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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