REALSQLdatabase.AttachDatabase

From Real Software Documentation

Jump to: navigation, search
Method
REALSQLdatabase.AttachDatabase ( file as FolderItem, databaseName as String[,password as String] ) As Boolean

Attaches the REAL SQL Database referred to by file to the database. It gives the newly attached database the name databaseName.

Notes

When a database has been attached, it is possible to do cross-database queries. In order to attach an encrypted database, you must pass the correct password for the database to be attached.

You should prefix all SQL queries to tables in the attached database with the databaseName.

Example

This example attaches a database. The code is in the Open event of the App object. AttachDB is declared as a REALSQLdatabase.

if AttachDB.AttachDatabase(AttachDB.databasefile,"Locations","fido45") = false then
DisplayDatabaseError( false )// there was an error connecting to the database
Quit
return
end if
Personal tools