1

I have Vbscript that modifies an existing record in a table in MSSQL:

Command.CommandText = "UPDATE Tabela_san SET Tabela_san.ilosc_na_roli = '" & ilosc_na_roli_form_id & "' WHERE  Tabela_san.ID = '" & ID_variable & "'"

The second script to an existing record in the MSSQL database adds only a character in the form of a value but does not increment it or sum it:

Command.CommandText = "update Tabela_san set Tabela_san.ilosc_na_roli = Tabela_san.ilosc_na_roli + '" & ilosc_na_roli_form_id & "'  WHERE  Tabela_san.ID = '" & ID_variable & "'"

The third script adds a value of 5 to the selected record and increases it by 5:

Command.CommandText = "update Tabela_san set Tabela_san.ilosc_na_roli = Tabela_san.ilosc_na_roli + 5  WHERE  Tabela_san.ID = '" & ID_variable & "'"

I would like the script to populate a number (quantity) of the ilosc_na_roli_form_id and call it with a script button added to the MSSQL database a value from the field ilosc_na_roli_form_id to the value contained in the MSSQL database summing it.

To work as a third script, but instead of constant 5, you could use the variable ilosc_na_roli_form_id (edit field) to sum the values ​​contained in the database. So for example: 5 + 2 = 7

1 Answer 1

1

Do you want to pass the value dynamically instead of constant then you can use this

Command.CommandText = "update Tabela_san set Tabela_san.ilosc_na_roli = Tabela_san.ilosc_na_roli + " & cInt(ilosc_na_roli_form_id) & " WHERE  Tabela_san.ID = '" & ID_variable & "'"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.