problem when updating money data from visual studio

0

the problem is that when wanting to update the table "product" all the data is updated well except the price, for example if I modify the name and status of the product but the value of the price of the product does not change it when wanting to save it overlays more zeros send the values of the datagrid to another screen and return them modified by pressing "modify" (CODE TO SEND VALUE SELECTED IN THE DATAGRID TO THE SCREEN TO MODIFY)

Private Sub Btmodificar_Click(sender As Object, e As EventArgs) Handles Btmodificar.Click
        modificar_productos.Label7.Text = "1"
        modificar_productos.Txid.Text = DataGridView1.CurrentRow.Cells.Item(0).Value.ToString
        modificar_productos.Txnombreproducto.Text = DataGridView1.CurrentRow.Cells.Item(1).Value.ToString
        modificar_productos.Cboxestadoproducto.Text = DataGridView1.CurrentRow.Cells.Item(2).Value.ToString
        modificar_productos.Txcantidadproducto.Text = DataGridView1.CurrentRow.Cells.Item(3).Value.ToString
        modificar_productos.Txplagacombate.Text = DataGridView1.CurrentRow.Cells.Item(4).Value.ToString
        modificar_productos.Txcostoproducto.Text = DataGridView1.CurrentRow.Cells.Item(5).Value.ToString
        modificar_productos.ShowDialog()
    End Sub

(MODIFY AND SEND DATAGRID)

Private Sub Btmodificarproducto_Click(sender As Object, e As EventArgs) Handles Btmodificarproducto.Click
        If (Txcantidadproducto.Text = "" Or Txcostoproducto.Text = "" Or Txnombreproducto.Text = "" Or Txplagacombate.Text = "" Or Cboxestadoproducto.Text = "") Then
            MsgBox("TODOS LOS CAMPOS SON OBLIGATORIOS!", MsgBoxStyle.Exclamation)
        Else
            Try
                Dim cnn As New SqlConnection("Data Source=KEVINJAIR\SQLEXPRESS;Initial Catalog=Control_de_plagas;Integrated Security=True")
                cnn.Open()
                Dim command2 As New SqlClient.SqlCommand("UPDATE Producto SET Nombre_Producto='" & Txnombreproducto.Text & "' ,Estado_Producto ='" & Cboxestadoproducto.Text & "' , Cantidad_Producto='" & Txcantidadproducto.Text & "' , Plaga_Combate='" & Txplagacombate.Text & "' , Costo_Producto='" & Txcostoproducto.Text & "' WHERE ID_Producto='" & Txid.Text & "'", cnn)
                command2.ExecuteNonQuery()
                Dim da As New SqlClient.SqlDataAdapter("SELECT [ID_Producto] As 'ID' ,[Nombre_Producto] As 'Nombre' ,[Estado_Producto] As 'Estado' ,[Cantidad_Producto] As 'Cantidad' ,[Plaga_Combate] As 'Plaga' ,[Costo_Producto] As 'Costo' FROM Producto", cnn)
                Dim ds As New DataSet
                da.Fill(ds)
                dv.Table = ds.Tables(0)
                cnn.Close()
                Catalogo_de__productos.DataGridView1.DataSource = dv
                Catalogo_de__productos.DataGridView1.Columns(0).Width = 50
                Catalogo_de__productos.DataGridView1.Columns(1).Width = 150
                Catalogo_de__productos.DataGridView1.Columns(2).Width = 100
                Catalogo_de__productos.DataGridView1.Columns(3).Width = 80
                Catalogo_de__productos.DataGridView1.Columns(4).Width = 130
                Catalogo_de__productos.DataGridView1.Columns(5).Width = 80
                Txcantidadproducto.Text = ""
                Txcostoproducto.Text = ""
                Txid.Text = ""
                Txnombreproducto.Text = ""
                Txplagacombate.Text = ""
                MsgBox("Se actualizo Correctamente.")
                Me.Hide()

            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Critical)

            End Try
        End If
    End Sub
    
asked by Kevin Barrera 06.12.2017 в 17:39
source

0 answers