KB-29668: Retrieving database status.

Question:

How can I tell whether the remote database is available when the network is down?

Solution:

To do so, use a script to test the Database’s ConnectionAtive property. However, before the test, you must force access to the database (for example, by running a simple query).

Example of script being executed in a button’s Click event:

    Screen.Item(“Query1”).Execute()
aux1 = Application.GetObject(“DB1”).ConnectionActive
MsgBox aux1

In the example above, the result is TRUE if the access to the database is ok and FALSE if it can’t be accessed.

Note: For performance reasons, the query can be inserted on the server, together with the ‘GetAsyncADORecordset‘ method for execution. In the ‘OnAsyncQueryFinish’ event of the query, the value returned by the Error parameter must be checked (TRUE indicates that there was an error).

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *