dbuse

Uses a particular database.

Syntax

RETCODE dbuse (
PDBPROCESS
dbproc,
LPCSTR
dbname );

where

dbproc
Is the DBPROCESS structure that is the handle for a particular workstation/ SQL Server process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.
dbname
Is a character pointer to a null-terminated string specifying the database name.

Returns

SUCCEED or FAIL.

Remarks

This function executes a Transact-SQL USE statement for the specified database for a particular DBPROCESS. It sets up the statement and calls dbsqlexec and dbresults.

If the USE statement fails because the requested database has not yet completed a recovery process, dbuse continues to send USE statements at 1-second intervals until it either succeeds or encounters some other error.

The function uses the dbproc provided by the caller and its command buffer. Any existing statements in the buffer are lost, and the command buffer is cleared by dbuse when it is finished.

See Also

dbchange, dbname, dbresults, dbsqlexec