
24/03/2006, 17:32
|
 | | | Fecha de Ingreso: enero-2004 Ubicación: h.frias 218-301
Mensajes: 121
Antigüedad: 21 años, 3 meses Puntos: 0 | |
cambiar de acces a sql Estoy haciendo un programa y esta enlazado a un archivo de acces, pero yo quiero que se enlace a sql, y la verdad no tengo ni la mas remota idea de como, ya le estuve intentando pero no me queda...
si alguien me puede ayudar se los agradecería.
este es mi codigo: Buscar
Private Sub Command1_Click()
Dim DB As Database
Dim TB As Recordset
SQL = "select * from usuarios where usuario = '" & Text1.Text & "' and contraseña = '" & Text2.Text & "'"
Set DB = OpenDatabase("c:\programa1.mdb")
Set TB = DB.OpenRecordset(SQL)
If TB.RecordCount > 0 Then
MsgBox "BIENVENIDO " & TB("nombre")
nivelusu = TB("nivel")
Unload Me
frmsin.Show 1
Else
MsgBox "Error en la Contraseña", 16,
Text2.Text = ""
Text2.SetFocus
End If
End Sub Guardar
Private Sub Command1_Click()
Dim DB As Database
Dim TB As Recordset
Dim SQL As String
Set DB = OpenDatabase("c:\programa1.mdb")
SQL = "select * from usuarios where usuario= '" & Text1.Text & "'"
Set TB = DB.OpenRecordset(SQL)
If TB.RecordCount > 0 Then
MsgBox "YA EXISTE"
Else
TB.AddNew
TB("usuario") = Text1.Text
TB("contraseña") = Text2.Text
TB("nombre") = Text3.Text
TB("nivel") = Text4.Text
TB.Update
MsgBox "REGISTRO GRABADO"
End If
TB.Close
DB.Close
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
__________________ Vampirito |