Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/09/2006, 01:19
Avatar de SuperPinwi
SuperPinwi
 
Fecha de Ingreso: septiembre-2005
Mensajes: 317
Antigüedad: 19 años, 6 meses
Puntos: 1
Solucionado compañero Al final he utilizado el dataAdapter, pero funciona perfectamente.

Este es el código resultante:

Código:
Public Shared Sub EjecutaHiloActualizaBD()
        Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Super.Pinwi\Mis documentos\Mis bases de datos\numeros\numeros.mdb")
        Dim objAcciones As New OleDbCommand
        Dim dt As DataTable
        Dim objAdapter As OleDbDataAdapter = New OleDbDataAdapter
        Dim OleDbUpdateCommand As OleDbCommand = New OleDbCommand
        Dim miDataSet As New DataSet
        'Variable de bucle
        Dim i As Integer
        'Para conocer el número de filas
        Dim n As Integer
        'Cadenas temporales para nombre y numero
        Dim sNombre As String
        Dim nNumero As Integer
        Dim dr As DataRow
        Dim fila As Integer

        Try
            objConn.Open()
            objAdapter = New OleDbDataAdapter("SELECT * FROM numeros ORDER BY numero", objConn)
            dt = New DataTable
            objAdapter.Fill(dt)
            n = dt.Rows.Count
            objAcciones.Connection = objConn
            objAdapter.UpdateCommand = OleDbUpdateCommand
            MessageBox.Show("LLEGO HASTA AQUÍ")
            If n = 0 Then
                MessageBox.Show("No se ha encontrado ningún registro que coincida con la selección")
            Else
                For fila = 0 To n - 1
                    dr = dt.Rows(fila)
                    OleDbUpdateCommand.Connection = objConn
                    OleDbUpdateCommand.CommandText = "UPDATE Numeros " & "SET numero = 1982"
                    OleDbUpdateCommand.ExecuteNonQuery()
                Next
            End If
        Catch ex As Exception
            MessageBox.Show(Err.Description, "Información del sistema")
        End Try
    End Sub
Gracias por el interés y la ayuda