conectar una base de datos d
quiero hacer un formulario en el quqe usuario ingrese
su nombre y contraseña quede registrado en la tabla hecho en access con fecha y hora
su nombre y contraseña quede registrado en la tabla hecho en access con fecha y hora
hombre con esto conectas
ahora el resrto es capturar lo datos y hcer un simple select
ok?
Option Explicit
'DECLARACION DE UN VARIABLE OBJETO DEL TIPO ADODB.CONNECTION
Public con_conexion As ADODB.Connection
Public rec_conexion As ADODB.Recordset
Public Sub ConectarBD()
'On Error GoTo error:
'SE INSTANCIA EL OBJETO CON AUTO DEL TIPO CONNECTION
Set con_conexion = New ADODB.Connection
'CONFIGURACION DEL CON_AUTO
con_conexion.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=TuBASEDEDATOS"
'SE ABRE LA CONEXION
con_conexion.Open
'error:
' If Err.Number > 0 Then
' Err.Description
' Resume Next
' End If
End Sub
Public Sub DesconectarBD()
'SE CIERRA LA CONEXION
con_conexion.Close
'LIBERAR MEMORIA
Set con_conexion = Nothing
End Sub
Public Sub Ejecutar(strsql As String)
' On Error GoTo error:
Set rec_conexion = New ADODB.Recordset
rec_conexion.CursorLocation = adUseClient
rec_conexion.Open strsql, con_conexion
'error:
' If Err.Number > 0 Then
' MsgBox Err.Description
' Resume Next
'End If
End Sub
ahora el resrto es capturar lo datos y hcer un simple select
ok?
Option Explicit
'DECLARACION DE UN VARIABLE OBJETO DEL TIPO ADODB.CONNECTION
Public con_conexion As ADODB.Connection
Public rec_conexion As ADODB.Recordset
Public Sub ConectarBD()
'On Error GoTo error:
'SE INSTANCIA EL OBJETO CON AUTO DEL TIPO CONNECTION
Set con_conexion = New ADODB.Connection
'CONFIGURACION DEL CON_AUTO
con_conexion.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=TuBASEDEDATOS"
'SE ABRE LA CONEXION
con_conexion.Open
'error:
' If Err.Number > 0 Then
' Err.Description
' Resume Next
' End If
End Sub
Public Sub DesconectarBD()
'SE CIERRA LA CONEXION
con_conexion.Close
'LIBERAR MEMORIA
Set con_conexion = Nothing
End Sub
Public Sub Ejecutar(strsql As String)
' On Error GoTo error:
Set rec_conexion = New ADODB.Recordset
rec_conexion.CursorLocation = adUseClient
rec_conexion.Open strsql, con_conexion
'error:
' If Err.Number > 0 Then
' MsgBox Err.Description
' Resume Next
'End If
End Sub
