02-28-2020 07:42 AM
Hello,
Is it possible to get feedback that INSERT INTO was successfully executed?
regards
Niklasson
02-28-2020 09:10 AM
Since this is a LabVIEW forum, I assume you are talking about using the Database Connectivity Toolkit. All VI's in the toolkit should have an Error Out terminal that will alert you if the query failed. You can use transactions, although that seems a bit overkill for a simple insert query.
If you need more specific answers, ask a specific'er question.
03-02-2020 12:53 PM
Agreed, the error out will tell you if it failed, so that's your indirect way of knowing it was a success.
Could also build a follow-up query that pulls the record you just updated and validates it's correct. Overkill? Depends on your application I suppose.
03-02-2020 01:17 PM
"Could also build a follow-up query that pulls the record you just updated and validates it's correct"
This will only work if no one else is writing to the database table. Multiple writers (say 3 versions of the same test machines) could result in reading back the wrong record.
You'll want to go with a stored procedure with a defined output parameter.
03-02-2020 01:45 PM
@pjroland1121 wrote:
"Could also build a follow-up query that pulls the record you just updated and validates it's correct"
This will only work if no one else is writing to the database table. Multiple writers (say 3 versions of the same test machines) could result in reading back the wrong record.
You'll want to go with a stored procedure with a defined output parameter.
To add to this, if you are inserting into a table with an identity specification, you can query this value as your output parameter. If the insert was not successful, you should get a NULL value, depending on the method used. You can do your own research to see which one fits your scenario best.