Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CRW_REF.PDF
Скачиваний:
5
Добавлен:
13.02.2015
Размер:
13.99 Mб
Скачать

SELECT TABLE.’CUSTOMER’,

SUM (TABLE.’ORDERAMOUNT’) FROM

‘TABLE’ TABLE GROUP BY

TABLE.’CUSTOMER’ HAVING

SUM (TABLE.’ORDERAMOUNT’) > 20000.00

For additional information

This chapter has only touched on some of the more important aspects of database access, relational databases, and SQL. If you are interested in learning more about database topics, refer to the documentation provided with your DBMS application.

In addition, there are hundreds of books available on the market that discuss database theory and design in depth. Look for the computer related section at your local bookstore.

HANDS-ON (Working With Databases)

This section provides step-by-step instructions for performing several common procedures related to accessing database files from within Seagate Crystal Reports. Use these procedures to get started working with the program quickly.

How to open Access queries through DAO

Microsoft Access queries can be used in Seagate Crystal Reports as separate data sets, just like Access tables. When opening an Access database through the DAO engine (Microsoft Access, Page 591), any queries in the database can be automatically read.

554

Seagate Crystal Reports User’s Guide

Click the NEW button on the standard toolbar. The Report Gallery appears.

2 Click the Custom button.

The Report Gallery expands.

3 Click the Custom

4 Click the Data

Report button.

File button.

The Choose Database File dialog box appears.

#Locate and highlight the Microsoft Access database (*.MDB) file that contains the query you want to use in your report.

$Click OK. The Design Tab appears in the application window with the Insert Fields dialog box.

%All of the tables and queries from your Access database appear in the list box on the Database Tab of the Insert Fields dialog box. Queries appear at the end of the list, after tables. Locate your query on the Database Tab, and double-click the name of the query in the list. The query expands to display all fields it contains.

&Select any fields you want to use in your report, and add them to the Design Tab.

NOTE: You can not use Access action queries or update queries in Seagate Crystal Reports. You can use Access select queries and cross-tab queries.

Working With Databases

555

How to open Access queries through ODBC

ODBC gives you more control over what parts of a database you want to use. For this reason, using an Access query through ODBC requires a few extra steps.

Choose the OPTIONS command from the File menu. The File Options dialog box appears. Click the SQL Tab to display SQL and ODBC options.

2 Make sure either the Views or the Prompt on every table check box is toggled on.

The Views option automatically displays any available queries in your Access database.

The Prompt on every table option displays the Allow Reporting On dialog box every time you log on to an ODBC data source. This dialog box provides the same options as the Allow Reporting On section of the File Options dialog box, but provides those options for every ODBC data source you log on to.

556

Seagate Crystal Reports User’s Guide

!In addition, you can specify Table name LIKE and Owner LIKE options if you wish.

Table name LIKE is based on the SQL LIKE clause. This option allows you to specify the kinds of table names you want to appear in the Choose SQL Table dialog box. Use the underscore character (_) or the percent sign character (%) as wildcards with this function. The underscore character specifies any single character, while the percent sign signifies any character string. For example, DAV_ matches DAVE only, while DAV% matches DAVE and DAVID. Table name LIKE C% would display only those tables that have a table name beginning with the letter C.

Owner LIKE is also based on the SQL LIKE clause. The Owner LIKE option allows you to select the Owner (or Creator or Alias) of the table, not the table name itself. For example Owner LIKE C% would display only those tables that had an owner beginning with the letter C.

" Click OK to exit the File Options dialog box.

#Create a new report. When you choose SQL/ODBC as the source of your data, the Log On Server dialog box appears.

6 Choose the ODBC data source for your Access database, then click OK.

%If you did not specify a particular Access database file with your Access ODBC data source, the Select Database dialog box will appear. Locate and select the database containing the Access query you want to use, and click OK.

&If you selected the Prompt on every table check box in the File Options dialog box, the Allow Reporting On dialog box now appears. Otherwise, skip to Step 10.

Working With Databases

557

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]