You can concatenate the UPDATE statement on vb.net

0

I have the following code is to update a database

Actualizar = "UPDATE" + TABLE + "Set Estatus = '" & TextBox3.Text & "' WHERE Num_Orden = '" & Form1.Text_Orden.Text & "'"

I would like to know how to concatenate the sentence "update" with the variable TABLE , TABLE is a variable of type string that takes the value of a combobox with multiple options

Since when I put

Actualizar = "UPDATE MIBASE Set Estatus = '" & TextBox3.Text & "' WHERE Num_Orden = '" & Form1.Text_Orden.Text & "'"

If the record is updated. I hope you can help me. Greetings.

    
asked by Miguel Olivan 01.07.2018 в 02:27
source

2 answers

0

The one you're looking for is:

Actualizar = "UPDATE " & TABLE & " Set Estatus = '" & TextBox3.Text & "' WHERE Num_Orden = '" & Form1.Text_Orden.Text & "'"
    
answered by 03.09.2018 / 15:32
source
0

To concatenate the variable to the Sting of the query is with &

An example:

Dim ssql as String

    Ssql=string.empty
    Ssql= "Update " & Variable 
    Ssql &= " Set Columna= Valor"
    Ssql &= " Where 1=1"

And you just execute the string Ssql.

    
answered by 01.07.2018 в 04:20