Description
This method returns an IAQADatabase
object previously created by CreateDatabase
.
Declaration
BDE.GetDatabase(DatabaseName)
DatabaseName | [in] | Required | String | |
Result | An IAQADatabase object |
Applies To
The method is applied to the following object:
Parameters
The method has the following parameter:
DatabaseName
The name of the existing database that you want to get.
Result Value
An object of the IAQADatabase
type.
Remarks
The IAQADatabase
object provides the same functionality for scripts as a TDatabase
object does in VCL applications. It implements the same methods and properties, under the same names. See the VCL documentation for TDatabase
.
Note: | This method requires the Borland Database Engine to be installed on your computer. |
Example
The code below obtains an existing database by its name and then posts the values of its VendorName field to the test log.
JavaScript, JScript
function GetDatabaseDemo()
{
// Obtains the object corresponding to the database
var Database = BDE.GetDatabase("DBDEMOS");
// Opens the database
Database.Open();
// Moves to the first record
Database.First();
// Iterates through all records and
// posts the value of the VendorName field to the test log
while (! Database.EOF() )
{
// Inserts a message into the test log
Log.Message(Database.FieldByName("VendorName").AsString);
// Moves to the next record
Database.Next();
}
}
Python
def GetDatabaseDemo():
# Obtains the object corresponding to the database
Database = BDE.GetDatabase("DBDEMOS")
# Opens the database
Database.Open()
# Moves to the first record
Database.First()
# Iterates through all records and
# posts the value of the VendorName field to the test log
while not Database.EOF():
# Inserts a message into the test log
Log.Message(Database.FieldByName("VendorName").AsString)
# Moves to the next record
Database.Next()
VBScript
Sub GetDatabaseDemo
' Obtains the object corresponding to the database
Set Database = BDE.GetDatabase("DBDEMOS")
' Opens the database
Database.Open
' Moves to the first record
Database.First
' Iterates through all records and
' posts the value of the VendorName field to the test log
While Not Database.EOF
' Inserts a message into the test log
Log.Message Database.FieldByName("VendorName").AsString
' Moves to the next record
Database.Next
Wend
End Sub
DelphiScript
function GetDatabaseDemo;
var Database;
begin
// Obtains the object corresponding to the database
Database := BDE.GetDatabase('DBDEMOS');
// Opens the database
Database.Open();
// Moves to the first record
Database.First();
// Iterates through all records and
// posts the value of the VendorName field to the test log
while (not Database.EOF() ) do
begin
// Inserts a message into the test log
Log.Message(Database.FieldByName('VendorName').AsString);
// Moves to the next record
Database.Next();
end;
end;
C++Script, C#Script
function GetDatabaseDemo()
{
// Obtains the object corresponding to the database
var Database = BDE["GetDatabase"]("DBDEMOS");
// Opens the database
Database["Open"]();
// Moves to the first record
Database["First"]();
// Iterates through all records and
// posts the value of the VendorName field to the test log
while (! Database["EOF"]() )
{
// Inserts a message into the test log
Log["Message"]( Database["FieldByName"]("VendorName")["AsString"] );
// Moves to the next record
Database["Next"]();
}
}