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

Application Object Properties

Property

Description

Read/Write

 

 

 

 

 

 

LastErrorCode

Returns the most recent error code. Used for errors at the

Read only

 

application level.

 

 

 

 

LastErrorString

Returns the most recent error string. Used for errors at the

Read only

 

application level.

 

 

 

 

Options

Returns the GlobalOptions Object (page 321), which allows you

Read only

 

to request more descriptive error messages from the Crystal

 

 

Report Engine.

 

Parent

Returns a null object (Nothing) as Application has no parent.

Read only

 

 

 

NOTE: When any Visual Basic standard error is returned, LastErrorString will be empty.

Application Object Methods

CanClose

The CanClose method indicates whether or not the Application Object (page 290), can be destroyed. This method will return FALSE as long as there are valid Report objects in existence. The Application object can be destroyed only if no instances of the Report Object (page 349), exist.

Syntax

object.CanClose

Returns

TRUE if the Engine can be closed.

FALSE if the Engine is busy.

ClearError

The ClearError method clears the application error code and string stored when calling the LastErrorCode and LastErrorString properties.

Syntax

object.ClearError

Crystal Report Engine Object Model for the Automation Server

291

LogOffServer

The LogOffServer method logs off an SQL server or ODBC data source. Use this method when you have logged on to the data source by using LogOnServer (page 292).

Syntax

object.LogOffServer DLLName, ServerName, _DatabaseName, UserID, Password

Parameters

DLLName

Specifies the name of the DLL for the server or password-protected non-SQL

 

table that you want to log on to (for example, “PDSODBC.DLL”). Note that the

 

DLLName must be enclosed in quotes. DLL names have the following naming

 

convention: PDB*.DLL for standard (non-SQL) databases, PDS*.DLL for SQL/

 

ODBC databases.

 

 

ServerName

Specifies the logon name for the server used to create the report.* (For ODBC,

 

use the data source name.) This value is case-sensitive.

DatabaseName

Specifies the name for the database used to create the report.*

(Optional)

 

 

 

UserID (Optional)

Specifies the User ID number necessary to log on to the server.*

 

 

Password (Optional)

Specifies the password necessary to log on to the server.

*When you pass an empty string (““) for this parameter, the program uses the value that is already set in the report. If you want to override a value that is already set in the report, use a non-empty string (for example, “Server A”).

Remarks

If you try to log off a server that is still in use (that is, there is an object variable still in focus that holds reference to a report that requires being logged on to the server to access data) you will be unable to log off. This will apply to every object that comes from the Report Object, Page 349, as they all hold reference to the report through their respective Report properties.

LogOnServer

The LogOnServer method logs on to an SQL server or ODBC data source. Once logged on by using this method, you will remain logged on until you call LogOffServer, Page 292, or until the Application Object, Page 290, is destroyed. This method corresponds to PELogOnServer, Volume 2, Chapter 1, of the Crystal Report Engine API.

Crystal Report Engine Object Model for the Automation Server

292

Syntax

object.LogOnServer DLLName, ServerName, _DatabaseName, UserID, Password

Parameters

DLLName

Specifies the name of the DLL for the server or password-protected non-SQL

 

table that you want to log on to (for example, “PDSODBC.DLL”). Note that the

 

DLLName must be enclosed in quotes. DLL names have the following naming

 

convention: PDB*.DLL for standard (non-SQL) databases, PDS*.DLL for SQL/

 

ODBC databases.

 

 

ServerName

Specifies the logon name for the server used to create the report.* (For ODBC,

 

use the data source name.) This value is case-sensitive.

 

 

DatabaseName

Specifies the name for the database used to create the report.*

(Optional)

 

 

 

UserID (Optional)

Specifies the User ID number necessary to log on to the server.*

Password (Optional)

Specifies the password necessary to log on to the server.

 

 

*When you pass an empty string (““) for this parameter, the program uses the value that is already set in the report. If you want to override a value that is already set in the report, use a non-empty string (for example, “Server A”).

OpenReport

The OpenReport method opens an existing report file, creating an instance of the Report object. Through the Report Object, Page 349, you can change formatting, formulas, selection formulas, and sort fields for the report, then print, preview, or export the report. This method corresponds to PEOpenPrintJob, Volume 2, Chapter 1, of the Crystal Report Engine API.

Syntax

Dim rep As Report

Set rep = app.OpenReport(ReportFilePath)

Parameters

ReportFilePath

Specifies a string value indicating the file name and path of the report that you want

 

to open.

 

 

Returns

Returns an instance of the Report Object, Page 349, if the report was successfully opened.

Returns 0 if the report file does not exist or if an error occurs.

Crystal Report Engine Object Model for the Automation Server

293

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