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

Tables

Declaration

property Tables: TCrpeTables;

Type

TCrpeTables = class(TPersistent)

Description

The Tables object maintains a list of Table information. The Name property is the Name of the Table. There are three general types of tables:

1.Native PC-type databases such as dBase, FoxPro, or Paradox, in which the Table Name is usually the same as the actual filename, and the Path is the actual DOS directory to the file. In these cases, the Name property can be used to change which Table is being used by the Report, the Path property can be used to change the directory in which the Table is located, and the Propagate property can be used to set all Tables to the same directory. The Password property applies to Paradox password-protected Tables.

2.Native PC-type databases such as Access, where the Table Name is the name of a table within the Database. In these cases, the Name property is the Name of the Database (or Access MDB file) which contains the Tables and the Path is the directory to the Database, not to the individual Table. It is possible to use the Tables object to change to a different MDB file, but it is not possible to change to a different Table within the same MDB. That must be done within the Crystal Reports Designer. For Access Password-protected Tables, use the SessionInfo object instead of the Password property of the Tables object.

3.SQL-type tables such as Oracle, Sybase, Informix, MS SQL Server, or ODBC Datasources. In these cases, Path and Propagate are not used. The Name property contains the name of the Table (and sometimes Database or User names as well) and can be used to point the Report to a different Table within the currently logged on Server.

The TableType, DLLName, and DescriptiveName properties are read-only properties which contain descriptive information about the Table, and are filled with values when the Retrieve method is used.

The ItemIndex property or the default array property, Item, can be used to navigate through the Tables.

The Count method returns the number of Tables in the current Report.

The Clear method can be used to clear the Tables object of all information, although this is normally handled automatically in the VCL whenever the ReportName is changed.

The Add and Delete properties are manual methods of maintaining the Tables object internal lists and are not needed if the Retrieve method is used.

The Send method sends the Table information from the VCL to the Crystal Reports Print Engine. This is normally handled in the Execute method of the VCL.

VCL Reference

116

Tables Example

In this example, the Tables are retrieved, and then a loop is set up to change the Path for all the tables:

Crpe1.ReportName := 'MyReport.rpt'; Crpe1.Tables.Retrieve;

for cnt := 0 to (Crpe1.Tables.Count - 1) do Crpe1.Tables[cnt].Path := 'c:\MyNewPath\';

Crpe1.Execute;

In the above scenario, the Propagate property could also be used, so that it would only be necessary to set the path for the first table:

Crpe1.ReportName := 'MyReport.rpt';

Crpe1.Tables.Retrieve;

Crpe1.Tables[0].Path := 'c:\MyNewPath\';

Crpe1.Tables.Propagate := True;

Crpe1.Execute;

Tables Properties

Tables DescriptiveName property, Page 668

Tables DLLName property, Page 668

Tables Item property, Page 669

Tables ItemIndex property, Page 670

Tables Name property, Page 670

Tables Number property, Page 671

Tables Password property, Page 672

Tables Path property, Page 672

Tables Propagate property, Page 673

Tables TableType property, Page 674

Tables Methods

Tables Clear method, Page 676

Tables CopyFrom method, Page 677

Tables Count method, Page 677

Tables Create method, Page 678

Table Delete method, Page 678

Tables Destroy method, Page 679

Tables Retrieve method, Page 679

Tables Send method, Page 680

VCL Reference

117

Соседние файлы в папке crystal