NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Update Query - not displayed in the sql statement selection in the data operation window

Hi guys,

 

im pretty new with TestStand and just started to perform some database operations with an mySQL database. I was kinda surprised that opening the database and reading values worked within a short tim.

 

Now I would like to update a value of an existing row/entry. Creating the the SQL statement wasn't a big deal, also setting it up in the "Open SQL Statement" worked without any problems. But when i try to select the statement handle in the "Data Operation" i only see the other statements ("Select"-querys) i created which read the database.

 

Open SQL Statement

There i choose my database handle, name the variable where i want to store the statement handle in and the sql query. No error pops up when push the "OK" button

OpenStatement.jpg

 

As soon as im done with the open statement i proceed with creating the data operation itself. I select the statement handle, tell the operation that i want to set and put the new value. When i switch to the 2nd tab i select the database handle again, but when i try to select the sql statement it just shows me the "SELECT"-statements (Open SQL Statement "Read ....") and not the one i entered with "UPDATE" (named 'Open SQL Statement "Update TestDate" ').

DataOperation.jpg

 

I already checked with the MySQL QueryBrowser if my account has permission to write data, which worked.

Does anyone of you have an idea where my mistake is at?

 

Thanks alot for reading and for any help 🙂

0 Kudos
Message 1 of 3
(4,570 Views)

Hi,

 

For queries such as Update, Create table or Drop table, you should only have "Open Statement" step to do the operations.

If you use "Select" statement in the "Open Statement" step, then you would need a "Data Operation" step to operate on the recordset returned by the "Select" statement.

 

If your use case is to only update a value of an existing row/entry using an "Update" query, then the "Open Statement" step would just work as it is without a "Data Operation" step.

 

You can refer to TestStand Help for more details

TestStand 2014: <Examples>\Built-In Step Types\Database Step Types\Database Step Types.seq

TestStand 2013 or earlier: <Examples>\Database\WritingAndReadingTableData.seq

 

Hope this helps.

 

Regards,

Sahana

Message 2 of 3
(4,540 Views)

Thanks alot for that advice, it just worked perfect. 🙂

 

Im just wondering why i didnt recognize that the open statement changed the value, somehow i thought that i did it manually

0 Kudos
Message 3 of 3
(4,535 Views)