Update a row in Table.Adapter

0

I was able to have new rows inserted into the table using the following code

    Dim newRow As DataRow = AppDataSet.Tables("clientes").NewRow()

    newRow("id") = idNew
    newRow("cliente") = TextBox2.Text
    newRow("nombre") = TextBox3.Text
    newRow("cargo") = TextBox4.Text
    newRow("cuit") = TextBox5.Text
    newRow("telefono") = TextBox6.Text
    newRow("movil") = TextBox7.Text
    newRow("asignado") = TextBox8.Text
    newRow("cuentaDe") = TextBox9.Text
    newRow("provincia") = TextBox10.Text
    newRow("codPostal") = TextBox11.Text
    newRow("paginaWeb") = TextBox12.Text
    newRow("notas") = TextBox13.Text


    AppDataSet.Tables("clientes").Rows.Add(newRow)
    ClientesTableAdapter.Update(newRow)

It works, but I want to do another one that updates when I modify elements of a row, with the following code

                Dim row As DataRow = AppDataSet.Tables("clientes").Rows(fila)


            row("cliente") = TextBox2.Text
            row("nombre") = TextBox3.Text
            row("cargo") = TextBox4.Text
            row("cuit") = TextBox5.Text
            row("telefono") = TextBox6.Text
            row("movil") = TextBox7.Text
            row("asignado") = TextBox8.Text
            row("cuentaDe") = TextBox9.Text
            row("provincia") = TextBox10.Text
            row("codPostal") = TextBox11.Text
            row("paginaWeb") = TextBox12.Text
            row("notas") = TextBox13.Text

At the end of this I do not find what to put in order to update the table with this modified row, in the datagrid you see the modification but I clearly need to use the tableAdapter in some way to update this row.

I used ClientsTableAdapter.Update (row) and gives error "Update requires UpdateCommand to be valid when the DataRow collection is passed with modified rows."

I do not get an idea of how to make the bd just update that row.

    
asked by Juan Ignacio Vera 08.02.2018 в 15:06
source

0 answers