Visual Basic - Conexiones ODBC

Life is soft - evento anual de software empresarial
 
Vista:

Conexiones ODBC

Publicado por Profy (2 intervenciones) el 10/11/2000 00:00:00
Me gustaria saber como conseguir los nombres de los odbc de sistema para poder listarlos posteriormente en un combobox, gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Conexiones ODBC

Publicado por gera (9 intervenciones) el 10/11/2000 00:00:00
Private Declare Function SQLDataSources Lib "ODBC32.DLL" (ByVal henv&, ByVal fDirection%, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN%, ByVal szDescription$, ByVal cbDescriptionMax%, pcbDescription%) As Integer

Sub Verifica_Odbc()

Dim I As Integer
Dim sDSNItem As String * 1024
Dim sDRVItem As String * 1024
Dim sDSN As String
Dim sDRV As String
Dim iDSNLen As Integer
Dim iDRVLen As Integer
Dim lHenv As Long ´controlador del entorno
If SQLAllocEnv(lHenv) <> -1 Then
Do Until I <> SQL_SUCCESS
sDSNItem = Space(1024)
sDRVItem = Space(1024)
I = SQLDataSources(lHenv, SQL_FETCH_NEXT, sDSNItem, 1024, iDSNLen, sDRVItem, 1024, iDRVLen)
sDSN = VBA.Left(sDSNItem, iDSNLen)
sDRV = VBA.Left(sDRVItem, iDRVLen)
If StrComp(sDSN, "PRUEBA", 1) = 0 Then Exit Sub
Loop
End If

End Sub

******************************
este codigo lo que hace es buscar un DSN que se llama PRUEBA ... saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar