DBSetConnectionAttribute

LabWindows/CVI SQL Toolkit 2.3 Help

Edition Date: August 2015

Part Number: 370502D-01

»View Product Info
Download Help (Windows Only)

int DBSetConnectionAttribute (int connectionHandle, tDBConnectionAttr attribute, ...);

Purpose

Sets a connection attribute. Because you must set most attributes before you open the connection (except when you use ATTR_DB_CONN_DEFAULT_DATABASE), DBSetConnectionAttribute is used most often in conjunction with DBNewConnection and DBOpenConnection.

Example

hdbc = DBNewConnection();

resCode = DBSetConnectionAttribute (hdbc,

ATTR_DB_CONN_CONNECTION_STRING, "DSN=cvi ss;User ID=sa;Password=");

resCode = DBSetConnectionAttribute (hdbc,

ATTR_DB_CONN_CONNECTION_TIMEOUT, 100);

resCode = DBSetConnectionAttribute (hdbc,

ATTR_DB_CONN_ISOLATION_LEVEL, DB_ISOLATION_LEVEL_SERIALIZABLE);

resCode = DBOpenConnection (hdbc);

...

resCode = DBCloseConnection (hdbc);

resCode = DBDiscardConnection (hdbc);

Parameters

Input
Name Type Description
connectionHandle int Handle to the connection that DBNewConnection returns or, if you can set the attribute after the connection is open, the connection that DBConnect returns.
attribute tDBConnectionAttr Attribute to set. Some providers do not support all attributes.
value ... Value for the attribute. The type of the value varies depending on the attribute. Some providers do not support all attributes.

Return Value

Name Type Description
resultCode int Result code that DBSetConnectionAttribute returns. This function returns the set of result codes listed in the LabWindows/CVI SQL Toolkit Error Codes topic in the LabWindows/CVI SQL Toolkit Help. Use DBErrorMessage to obtain the text of the error message.

WAS THIS ARTICLE HELPFUL?

Not Helpful