14/08/2011, 17:26
|
| | Fecha de Ingreso: noviembre-2010 Ubicación: madrid
Mensajes: 478
Antigüedad: 13 años, 11 meses Puntos: 5 | |
Respuesta: Update en un textbox ahora me dice que no coinciden los datos en la expresion de criterios...en IDCOMANDA...PORQ UEEEEE
Dim adapt As New OleDbDataAdapter
Dim setda As New DataSet
Dim com = conexion.CreateCommand
Dim total As Decimal = 0
Dim totalcelda As Decimal = 0
Dim totalfinal As Decimal = 0
Dim division As Single
For Each row As DataGridViewRow In DgTotales.Rows
'carga el textbox total con lo que exista en el grid
Dim s As String = CType(row.Cells(5).Value, String)
If row.Cells(0).Value Is Nothing Then
MessageBox.Show("Estimación Finalizada", "Aviso GesDreamtpos")
ElseIf s = "TARJETA CREDITO" Then
MessageBox.Show("es tarjeta")
Else
'totalcelda = CDec(CDec(total + Val(row.Cells(1).Value) * Val(row.Cells(2).Value)))
' total = CDec(CDec(total + Val(row.Cells(1).Value) * Val(row.Cells(2).Value)) * CDbl(TxtPorcentaje.Text) / 100)
totalcelda = CDec(Val(row.Cells(1).Value) * Val(row.Cells(2).Value))
total = CDec((Val(row.Cells(1).Value) * Val(row.Cells(2).Value)) * CDbl(TxtPorcentaje.Text) / 100)
totalfinal = CDec(CStr(CDec(totalcelda - total)))
division = CDec(totalfinal / Val(row.Cells(1).Value))
'Textprueba.Text = CStr(division.ToString("#,##0.00€"))
Textprueba.Text = CStr(CSng(division))
com.CommandType = CommandType.Text
com.CommandText = "UPDATE IntroduccionDeVentasAhora SET Pts = ('" & Textprueba.Text & "') Where IdComanda = @valor and NombreFormaPago <> ('TARJETA CREDITO') and Fecha BETWEEN @FI AND @FF"
com.Parameters.AddWithValue("@FI", Fecha1.Value.Date.ToString("dd/MM/yyyy"))
com.Parameters.AddWithValue("@FF", Fecha2.Value.Date.ToString("dd/MM/yyyy"))
com.Parameters.AddWithValue("@valor", DgTotales.CurrentRow.Cells(11).Value.ToString)
adapt.SelectCommand = com
conexion.Open()
com.ExecuteNonQuery()
conexion.Close()
End If
Next |