VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Dynamically generate an ODBC DSN

Royce Powers  (4 Submissions)   Databases/Data Access/DAO/ADO   Visual Basic 3.0   Advanced   Wed 3rd February 2021

Class object that can be compiled or copied and pasted into your application that will dynamically create ODBC DSN's for you.

Inputs
DSN Name, Server, Database, DSN Type, UserID and Password

Returns
0 if success, OSBC DSN is created

API Declarations
Declare Function SQLAllocConnect Lib "odbc32.dll" (ByVal henv _
As Long, phdbc As Long) As Integer
Declare Function SQLDisconnect Lib "odbc32.dll" (ByVal hdbc As _
Long) As Integer
Declare Function SQLConnect Lib "odbc32.dll" (ByVal hdbc As _
Long, ByVal szDSN As String, ByVal cbDSN As Integer, ByVal szUID As _
String, ByVal cbUID As Integer, ByVal szAuthStr As String, ByVal _
cbAuthStr As Integer) As Integer
Declare Function SQLFreeEnv Lib "odbc32.dll" (ByVal henv As _
Long) As Integer
Declare Function SQLFreeConnect Lib "odbc32.dll" (ByVal hdbc _
As Long) As Integer
Declare Function SQLError Lib "odbc32.dll" (ByVal henv As _
Long, ByVal hdbc As Long, ByVal hstmt As Long, ByVal szSqlState As _
String, pfNativeError As Long, ByVal szErrorMsg As String, ByVal _
cbErrorMsgMax As Integer, pcbErrorMsg As Integer) As Integer
Declare Function SQLConfigDataSource Lib "ODBCCP32" _
(ByVal hwndParent As Long, ByVal fRequest As Long, _
ByVal lpszDriver As String, ByVal lpszAttributes As String) As Long

Rate Dynamically generate an ODBC DSN (7(7 Vote))
Dynamically generate an ODBC DSN.bas

Dynamically generate an ODBC DSN Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters