On Wed, 13 Dec 2000, Aziz ABI wrote:
> Merci pour votre exemple
>
> Mais ce que je veux c'est de cr�er une connexion ODBC � partie d'un
> programme VB sans passer par ODBC 32 du panneau de configuration.
>
> Merci
Ah, sounds as if you want to create the DSN, not the connection.
Try this:
Declare Function SQLConfigDataSource Lib "ODBCCP32" _ (ByVal pWind As Long, _ ByVal reqType As Long, _ ByVal
driverAs String, _ ByVal attrs As String) As Long
Private Sub Form_Load() Dim rc As Long ' 1=ODBC_ADD_DSN rc = SQLConfigDataSource(0, 1, "PostgreSQL", _
"DSN=NouvelleDS" & Chr(0) & _ "Servername=foo" & Chr(0) & _
"Username=bar" & Chr(0) & _ "Port=5432" & Chr(0) & _
"Protocol=6.4"& Chr(0) & _ "ReadOnly=0" & Chr(0) & _
"RowVersioning=0"& Chr(0) & _ Chr(0)) If rc = 0 Then MsgBox "Can't create data
source" Else MsgBox "Data source created successfully" End If
End Sub
--
Bob Kline
mailto:bkline@rksystems.com
http://www.rksystems.com