Mensaje enviado por José Rubí de la Vega <jrubi@ctv.es>
Estan en el registro en : HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\ODBC
Data Sources
At 09:37 13/12/99 -0600, you wrote:
> Quiero hacer una aplicación que tenga acceso a distintos servidores, pero que el >usuario pueda seleccionar el ODBC a usar, ¿ Alguien sabe como puedo hacer para mostrar >todos los ODBC's disponibles en la PC?.
Un saludo.
_________________________________________________ José Rubí de la Vega
E-mail : jrubi@ctv.es
WWW : http://www.ctv.es/USERS/jrubi
Podrás encontrar información sobre VB, las listas vb-esp y visualbasic-esp y un
resumen de los mensajes de las mismas
Mensaje enviado por JUAN FELIPE BETANCUR <JBETANCUR@hermeco.com>
Hola.
Puedes hacer lo siguiente:
En el Load del formulario pones el siguiente código, hay un combo que se llama cboDSN:
Private Sub Form_Load()
Dim intCount, intIndex As Integer
GetAvailableDSNs
intCount = UBound(astrDSN)
For intIndex = 0 To intCount
cboDSN.AddItem astrDSN(intIndex)
Next
elDSN = cboDSN.Text
End Sub
Y en la declaración general todo esto:
Private Sub GetAvailableDSNs()
Dim strWindowsDir As String
Dim strBuffer As String
Dim lngApiRet As Long
Dim intStartPos As Integer, intEndPos As Integer
Dim intEqualPos As Integer, intIndex As Integer, strLine As String
strWindowsDir = String(255, 0)
lngApiRet = GetWindowsDirectory(strWindowsDir, 255)
strWindowsDir = Left(strWindowsDir, lngApiRet)
If Right(strWindowsDir, 1) <> "\" Then strWindowsDir = strWindowsDir & "\"
strBuffer = String(3072, 0)
lngApiRet = GetPrivateProfileSection("ODBC 32 bit Data Sources", strBuffer, Len(strBuffer), strWindowsDir & "ODBC.INI")
strBuffer = Left(strBuffer, lngApiRet)
intStartPos = 1
Do
intEndPos = InStr(intStartPos, strBuffer, Chr(0))
If intEndPos <> 0 Then
ReDim Preserve astrDSN(intIndex)
strLine = Mid(strBuffer, intStartPos, intEndPos - 1)
intEqualPos = InStr(strLine, "=")
If intEqualPos = 0 Then Exit Do
astrDSN(intIndex) = Left(strLine, intEqualPos - 1)
#If cccDebug = 1 Then
Debug.Print astrDSN(intIndex)
#End If
Else
Exit Do
End If
intStartPos = intEndPos + 1
intIndex = intIndex + 1
Loop
End Sub
Chao.
Att:
Felipe Betancur Uribe
Microsoft Certified Professional
Analista-Programador
Alcuadrado S.A.
Conocimiento bien Aplicado!
Calle 8. No.43B - 90
Medellín - Colombia
Tel. +(574) 3110447. Ext.131
Fax +(574) 3118985
Tel. +(574) (033) 4347015
<http://www.alcuadrado.com/>
-----Original Message-----
From: Hernan Santos [mailto:hsantos@gsystems.com.ar]
Sent: Thursday, August 03, 2000 10:16 AM
To: Vb-Esp (Correo electrónico); Vb-Esp (Correo electrónico)
Subject: vb-esp : Urgente:ODBC
Importance: High
Por favor amigos:
Necesito listar los odbc que tengo en mi maquina (mediante vb) y
mostrarlos en un list
Desde ya gracias por la ayuda que puedan darme.