Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/02/2014, 04:48
franco55
 
Fecha de Ingreso: febrero-2014
Ubicación: la banda
Mensajes: 31
Antigüedad: 10 años, 2 meses
Puntos: 0
consulta select para un label

Amigos tengo este codigo para poner la matricula de un medico traido de una bd de mysql en un textbox pero nose como es la sentencia hasta aqui anda bien...
sql = "select matricula from doctor where apellidomed like'" & .Label4.Caption
&"%'"

Aqui la sentencia.....................

Private Sub Command2_Click()
nuetur.show
' verifica que hay datos en el ListView y que hay uno seleccionado
If (ListView1.ListItems.Count = 0) Then
MsgBox "No hay ningún regisro para editar", vbInformation
Exit Sub
End If
If (ListView1.SelectedItem Is Nothing) Then
MsgBox "Debe seleccionar previamente un registro para poder editarlo", vbInformation
Exit Sub
End If
With nuetur
' obtiene el elemento seleccionado
.Label3.Caption = ListView1.SelectedItem.Text
.Label4.Caption = ListView1.SelectedItem.ListSubItems(2).Text

'Dim matricula As String
.Label4.Caption = ListView1.SelectedItem.ListSubItems(2).Text
Set rs = New ADODB.Recordset
sql = "select matricula from doctor where apellidomed like'" & .Label4.Caption & "%'"
MsgBox (sql)
cn.Execute sql
'matricula = sql
.Label6.Caption = sql

End With