-3
Else
            conn2.Open()
            Dim cmd3 As New SqlCommand("update Pr_masterItem
        (item_id, item_name, inventory, subtitutes_exist, assembly_bom, satuan, cost_is_adjusted, harga_beli, harga_jual) values
        (@item_id, @item_name, @inventory, @subtitutes_exist, @assembly_bom, @satuan, @cost_is_adjusted, @harga_beli, @harga_jual)", conn2)
            cmd3.Parameters.AddWithValue("item_id", row.Cells("item_id").Value.ToString)
            cmd3.Parameters.AddWithValue("item_name", row.Cells("item_name").Value.ToString)
            cmd3.Parameters.AddWithValue("inventory", row.Cells("inventory").Value.ToString)
            cmd3.Parameters.AddWithValue("subtitutes_exist", row.Cells("subtitutes_exist").Value.ToString)
            cmd3.Parameters.AddWithValue("assembly_bom", row.Cells("assembly_bom").Value.ToString)
            cmd3.Parameters.AddWithValue("satuan", row.Cells("satuan").Value.ToString)
            cmd3.Parameters.AddWithValue("cost_is_adjusted", row.Cells("cost_is_adjusted").Value.ToString)
            cmd3.Parameters.AddWithValue("harga_beli", row.Cells("harga_beli").Value.ToString)
            cmd3.Parameters.AddWithValue("harga_jual", row.Cells("harga_jual").Value.ToString)

            cmd3.ExecuteNonQuery()
            'MessageBox.Show("Update Data")
            conn2.Close()
        End If

    Next
    MessageBox.Show("Berhasil")
End Sub

this code must be update the data excel to sql.

starball
  • 20,030
  • 7
  • 43
  • 238
Ari's
  • 1
  • 3

1 Answers1

0

Try this one:-

        cmd3.ExecuteNonQuery()
        MessageBox.Show("Update Data")
        conn2.Close()
    End If

Next
MessageBox.Show("Berhasil")

End Sub