Databases Reference
In-Depth Information
Const SQL_HANDLE_ENV = 1
Const SQL_FETCH_NEXT = 1
Const SQL_FETCH_FIRST = 2
Const SQL_SUCCESS = 0
Const SQL_ATTR_ODBC_VERSION = 200
Const SQL_OV_ODBC2 = 2
Const SQL_IS_INTEGER = -6
Dim nRetCode As Long
Declare Function SQLDrivers Lib "odbc32.dll" (ByVal _
EnvironmentHandle As Long, ByVal Direction As Integer, _
ByVal DriverDescription As String, ByVal BufferLength1 As Integer,
_
DescriptionLengthPtr As Integer, ByVal DriverAttributes As String,
_
ByVal BufferLength2 As Integer, AttributesLengthPtr As Integer) _
As Integer
' Note that pointers to numbers are passed as numbers by reference!
Declare Function SQLDataSources Lib "odbc32.dll" (ByVal _
EnvironmentHandle As Long, ByVal Direction As Integer, _
ByVal ServerName As String, ByVal BufferLength1 As Integer, _
NameLength1Ptr As Integer, ByVal Description As String, _
ByVal BufferLength2 As Integer, NameLength2Ptr As Integer) As
Integer
Declare Function SQLFreeHandle Lib "odbc32.dll" (ByVal _
HandleType As Integer, ByVal Handle As Long) As Integer
Declare Function SQLAllocHandle Lib "odbc32.dll" (ByVal _
HandleType As Integer, ByVal InputHandle As Long, _
OutputHandlePtr As Long) As Integer
Declare Function SQLSetEnvAttr Lib "odbc32.dll" (ByVal _
EnvironmentHandle As Long, ByVal EnvAttribute As Long, _
ByVal ValuePtr As Long, ByVal StringLength As Long) As Integer
Declare Function SQLDisconnect Lib "odbc32.dll" (ByVal _
ConnectionHandle As Long) As Integer
Public Function Trim0(sName As String) As String
' Keep left portion of string sName up to first 0.
Dim x As Integer
x = InStr(sName, Chr$(0))
If x > 0 Then Trim0 = Left$(sName, x - 1) Else Trim0 = sName
End Function
Private Sub ListODBCSources( )
' Prints a list of ODBC data soruces/drivers on system
Dim lHEnv As Long
Search WWH ::




Custom Search