Ver Mensaje Individual
  #5 (permalink)  
Antiguo 30/07/2011, 03:07
guillebomtrasmiti
 
Fecha de Ingreso: noviembre-2010
Ubicación: madrid
Mensajes: 478
Antigüedad: 13 años, 6 meses
Puntos: 5
Respuesta: suma si la fecha es diferente

bien he conseguido sumar bien la cantidad pero no me la asigna en la grilla, en la grilla me suma 1 sobre todos los campos...en cambio en el for each RESULTADO va sumando bien la cantidad?¿?

Dim contador As New Integer
Dim resultado As New Integer
For Each row As DataGridViewRow In DgGenerados.Rows
contador = CInt(Val(row.Cells(1).Value) + Val(row.Cells(0).Value))
resultado = contador

Dim adapt As New OleDbDataAdapter
Dim setda As New DataSet
Dim com = conexion.CreateCommand

com.CommandType = CommandType.Text
com.CommandText = "UPDATE HistoricoTickets SET NTicket =" & resultado & " Where NTicket = @FA"
'where NTicket = @FA and Id = @FI"
com.Parameters.AddWithValue("@FA", DgGenerados.CurrentRow.Cells(1).Value)
'com.Parameters.AddWithValue("@FI", DgGenerados.CurrentRow.Cells(0).Value)

adapt.UpdateCommand = com
conexion.Open()
com.ExecuteNonQuery()
conexion.Close()

Next

sabeis por qué?¿?