Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "SQLAllocHandle" in [All]

odbc32

. .
Summary
SQLAllocHandle allocates an environment, connection, statement, or descriptor handle.
.

extern static short SQLAllocHandle(ushort HandleType, int InputHandle, out IntPtr OutputHandle);

.

Private Declare Auto Function SQLAllocHandle Lib "odbc32.dll" (ByVal HandleType As Short, ByVal InputHandle As IntPtr, ByRef OutputHandle As IntPtr) As Short

.

    private static extern short SQLAllocHandle(short hType, IntPtr inputHandle, out IntPtr outputHandle);

.

        if (SQL_SUCCESS == SQLAllocHandle(SQL_HANDLE_ENV, henv, out henv))

.

            if (SQL_SUCCESS == SQLAllocHandle(SQL_HANDLE_DBC, henv, out hconn))

.
Documentation
[SQLAllocHandle] on MSDN
.

            SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, out environmentHandle);

.

            SQLAllocHandle(SQL_HANDLE_DBC, environmentHandle.ToInt32(), out dbcHandle);

.

            SQLAllocHandle(SQL_HANDLE_STMT, dbcHandle.ToInt32(), out stmtHandle);

.

You must provide an Environment Handle provided by SQLAllocHandle as the first parameter. SQLAllocHandle is a replacement for SQLAllocEnv. When using SQLAllocHandle, you must call SQLSetEnvAttr and set the SQL_ATTR_ODBC_VERSION attribute to SQL_OV_ODBC3 before calling SQLDataSources. You must release Environment handle with SQLFreeHandle at the end.

.

    rc = SQLAllocHandle(SQL_HANDLE_ENV, 0, out sql_env_handle);

.
Documentation
SQLDataSources, SQLAllocHandle, [SQLAllocEnv] on MSDN
.

Frees a handle allocated by SQLAllocHandle.


 
Access PInvoke.net directly from VS: