Ver Mensaje Individual
  #15 (permalink)  
Antiguo 30/03/2006, 15:59
Avatar de vampirito
vampirito
 
Fecha de Ingreso: enero-2004
Ubicación: h.frias 218-301
Mensajes: 121
Antigüedad: 20 años, 4 meses
Puntos: 0
ok, mil gracias!!!!
ya quedo!!!!

pongo el codigo completo para el que lo necesite

Option Explicit

Private cnn As ADODB.Connection
Private Rst As ADODB.Recordset

Private Sub Command1_Click()
Dim Rst As ADODB.Recordset
Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
Rst.Open "Select * from usuarios where usuario = '" & UCase(Trim(Text1)) & "'", cnn, adOpenStatic, adLockOptimistic, adCmdText
If Not Rst.EOF Then
MsgBox "ya existe"
Else
Rst.AddNew
Rst!usuario = UCase(Trim(Text1))
Rst!contraseña = UCase(Trim(Text2))
Rst!nombre = UCase(Trim(Text3))
Rst!nivel = UCase(Trim(Text4))
Rst.Update
Rst.Close
Set Rst = Nothing
MsgBox "Registro Guardado"
End If
End Sub

Private Sub Command2_Click()
cnn.Execute "DELETE FROM usuarios Where usuario = '" & UCase(Trim(Text1)) & "'"
End Sub

Private Sub Form_Load()
Set cnn = Nothing
Set Rst = Nothing
Set cnn = New ADODB.Connection
Set Rst = New ADODB.Recordset

cnn.ConnectionString = "Provider= SQLOLEDB.1;" & _
"Persist Security Info= False;" & _
"Integrated Security= SSPI;" & _
"Password= sa; User ID= sa; " & _
"Initial Catalog=sistema; " & _
"Data Source= (local);"
cnn.Open

End Sub
__________________
Vampirito