
10/03/2006, 22:38
|
 | Usuario no validado | | Fecha de Ingreso: marzo-2005
Mensajes: 194
Antigüedad: 20 años, 1 mes Puntos: 0 | |
Ya consegui mostrarlos como queria ahora solo me falta eliminar el registro seleccionado en el listview se elimine en la base de datos.... pude eliminar del listview pero no se como hacerlo para borrarlo de la base de datos.... pongo el codigo para ayuda...
AQUI SELECCIONO Y MUESTRO LOS REGISTROS
Dim rstUsuarios As ADODB.Recordset
Dim strCnn As String
' Abre la tabla usuarios
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Archivos de programa\SoftwareSCC\Datos\bdSCC.mdb;Persist Security Info=FalseProvider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Archivos de programa\SoftwareSCC\Datos\bdSCC.mdb;Persist Security Info=False"
Set rstUsuarios = New ADODB.Recordset
rstUsuarios.CursorLocation = adUseClient
rstUsuarios.CursorType = adOpenDynamic
rstUsuarios.LockType = adLockBatchOptimistic
rstUsuarios.Open "SELECT Nombre,ApellidoPaterno,ApellidoMaterno,Calle,Numer o,Telefono,NombreUsuario FROM Usuario " & _
"", strCnn, , , adCmdText
With rstUsuarios
' Nombre1 = .Fields(Nombre & ApellidoPaterno & ApellidoMaterno)
If (.BOF And .BOF) Then
MsgBox "Base de datos vacia", vbInformation + vbOKOnly, "SCC" 'Enviar mensaje de error
Else
ListView1.ListItems.Clear
.MoveFirst
Do While Not .EOF
Set tli = ListView1.ListItems.Add(, , .Fields("Nombre"))
tli.SubItems(1) = .Fields("ApellidoPaterno")
tli.SubItems(2) = .Fields("ApellidoMaterno")
.MoveNext
Loop
End If
End With
Y AQUI ELIMINO DEL LISTVIEW
Private Sub cmdBaja_Click()
Dim intConfirmacion As Integer
For i = ListView1.ListItems.Count To 1 Step -1
If ListView1.ListItems(i).Selected Then
intConfirmacion = MsgBox("Estas a punto de eliminar un registro de la base de datos, ¿deseas continuar?", _
vbCritical + vbYesNo, "SCC")
If intConfirmacion = vbYes Then
ListView1.ListItems.Remove i
Else
End If
End If
Next i
End Sub
COMO LE HAGO PARA ELIMINARLO DE LA BD...... |