Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Database API > Methods

Database API: SetConnection() 

Scroll Prev Next More

 

Sets the current database connection. Recommended for use when working with multiple database connections.

 
All consequent API calls made via DB API functions will be executed via this connection. When working with the default (primary) connection the call of this function is not required.

 

To switch back to primary connection call this function without arguments.

Syntax

DB_SetConnection(name)

Arguments

name

the connection name, as it appears in wizard.

multiple_connections

Return value

No return value.

Example

'switch connection to Northwind
DB_SetConnection("Northwind")
 
'execute query
DB_Exec("UPDATE `orders` SET `Status`='shipped' WHERE OrderDate=CURDATE()")
 
'switch back to primary connection
DB_SetConnection("")

See also:

Database API: Exec()

Database API: LastId()

Database API: LastError()

Connecting to the database

About Database API