Tema: boton buscar
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 30/03/2006, 12:07
Avatar de vampirito
vampirito
 
Fecha de Ingreso: enero-2004
Ubicación: h.frias 218-301
Mensajes: 121
Antigüedad: 21 años, 5 meses
Puntos: 0
ya resolvi mi problema y asi quedo el codigo:

Option Explicit

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

Private Sub Command1_Click()
Command1.Enabled = False
Dim Sql As String
Dim Rst As New ADODB.Recordset

Sql = "Select * from usuarios where usuario = '" & UCase(Trim(Text1)) & "'"
With Rst
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.Source = Sql
Set .ActiveConnection = cnn
.Open
If Not .EOF And Not .BOF Then
Text2.Text = Rst!nombre
Text3.Text = Rst!paterno & " " & Rst!materno
Label4.Caption = "Usuario Encontrado"
Else
Label4.Caption = "Usuario Inexistente"
End If
End With
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=ejemplouno; " & _
"Data Source= (local);"
cnn.Open
End Sub


Gracias por su tiempo y su ayuda!!!!
__________________
Vampirito