Haga un modulo y pega esto, no olvide agregar las referencias creo que es microsoft Activex Data objects 2.1 Microsoft Dao 3.51
Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public cmd As Command
Public Sub conectar()
Set cn = New ADODB.Connection
CONEXION = "DSN=CRL;" & "Provider=MSDASQL;" & "UID=usrRH;" & "PWD=12345;"
cn.Open CONEXION
If cn.State = 0 Then
MsgBox "error"
End If
End Sub
Public Sub desconectar()
Set rs = Nothing
'''''''''''''''
Set cmd = Nothing
''''''''''''''''''''''''''
Set cn = Nothing
End Sub
Public Sub EjecutaSQL(sql As String)
Set cmd = New ADODB.Command
Set rs = New ADODB.Recordset
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
cmd.CommandText = sql
Set rs = cmd.Execute
End Sub
GRACIAS.
y sooy jooooooto y ke
busco novio no muy guapo
declaro
si algo falta pidele a Dios la paciencia para llegar al cielo
Por favor Aiuda ssiiiiiii