
20/01/2006, 17:35
|
 | | | Fecha de Ingreso: diciembre-2002 Ubicación: santiago-chilito
Mensajes: 1.931
Antigüedad: 22 años, 4 meses Puntos: 2 | |
hola ese ejemplo esta probado , ponlo dentro de un boton . no te olivedes hacer la referencia a MICROSOFT ACTIVEX DATA OBJECTS 2.8 LIBRARY
un saludo
Private Sub Command1_Click()
Dim CON As ADODB.Connection
Dim comd As ADODB.Command
Dim rt As ADODB.Recordset
Set CON = New ADODB.Connection
Set comd = New ADODB.Command
Set rt = New ADODB.Recordset
CON.CommandTimeout = 40
CON.CursorLocation = 1
'CON.ConnectionString = "server=localhost;driver=mysql;db=proyecto"
CON.Open "DRIVER={MySQL ODBC 3.51 Driver};DATABASE=rm;SERVER=172.16.7.136;UID=mysql; PASSWORD=palam;PORT=3306;"
'CON.Open
Set comd.ActiveConnection = CON
comd.CommandType = 1
comd.CommandText = "select cod_dep from departamentos where cod_dep=3"
rt.Open comd, , 1, 1
MsgBox rt.Fields("cod_dep")
End Sub
__________________ "Cuando se adelanta un oponente, enfréntalo y salúdalo; si intenta retroceder, déjalo seguir su camino" |