
09/02/2011, 16:00
|
| | Fecha de Ingreso: febrero-2011 Ubicación: Venezuela
Mensajes: 2
Antigüedad: 14 años, 1 mes Puntos: 0 | |
Acces a Mysql hola a todos soy nuevo en esta pagina, mi pregunta es la siguiente tengo un sistemita realizado en visual basic 6.0 con base de datos en acces y quisisera que modificarla para que me lea los datos de una base de datos en mysql pero no se como hacerle para empezar si me podrian dar alguna idea, Ajunto la programacion del formulario de acceso al sistema a ves si me pueden ayudar para ir viendo que tendria que hacer muchas gracias.
Código:
Option Explicit
Private Sub Command1_Click()
'Recuerda destruir las direcciones de la memoria...
nc.Close
Set nc = Nothing
End
End Sub
Private Sub Command2_Click()
If Trim(Combo1.Text) = "" Then
MsgBox "Seleccione el nombre de usuarios", 16, "Para Ingresar al sistema"
Combo1.SetFocus
Exit Sub
End If
If Trim(Clave.Text) = "" Then
MsgBox "Ingrese su clave de acceso", 16, "Para ingresar al sistema"
Clave.SetFocus
Exit Sub
End If
Ingresar_Clave
End Sub
Private Sub Form_Load()
Iniciar_Conexion
Cargar_Usuarios
End Sub
Private Sub Iniciar_Conexion()
Dim sPath As String
sPath = App.Path & "\sg1.mdb"
With nc
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Properties("Data Source").Value = sPath
.Properties("Persist Security Info").Value = False
.Open
End With
End Sub
Private Sub Cargar_Usuarios()
Dim rs As New ADODB.Recordset
rs.Open "SELECT * FROM usuarios", nc, adOpenDynamic, adLockOptimistic
While Not rs.EOF
Combo1.AddItem rs!Nombre
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
End Sub
Private Sub Ingresar_Clave()
Dim rec As New ADODB.Recordset
Dim clav As String
Dim EstM As Boolean
rec.Open "SELECT * FROM usuarios where Clave='" & Trim(Clave.Text) & "'", nc, adOpenStatic, adLockOptimistic, adCmdText
With rec
If .RecordCount > 0 Then
clav = Trim(.Fields("Clave"))
If clav = Trim(Clave.Text) Then
MsgBox "Bievenido a Archivos del Sistema" & Space(2) & Combo1.Text, vbInformation, "Bienvenido al Sistema"
Unload Me
EstM = True
MDIForm1.Show
Else
MsgBox "Clave Incorrecta", vbInformation, "Aviso..!!"
Clave = ""
Clave.SetFocus
End If
End If
End With
rec.Close
Set rec = Nothing
End Sub
|