Error - I'm getting a result set?

Trying to write to a tag the results of a query on a button press. This is script:

query = """SELECT * FROM FORECASTS"""
r = system.db.runUpdateQuery(query, "MurakamiSQL")
system.tag.write(Forecastedcomps,r)

This is error:

Traceback (most recent call last):
File "event:mousePressed", line 2, in
java.lang.Exception: java.lang.Exception: Error executing system.db.runUpdateQuery(SELECT * FROM FORECASTS, MurakamiSQL, , false)

caused by Exception: Error executing system.db.runUpdateQuery(SELECT * FROM FORECASTS, MurakamiSQL, , false)
caused by GatewayException: SQL error for "SELECT * FROM FORECASTS": A result set was generated for update.
caused by SQLServerException: A result set was generated for update.

Ignition v8.0.2 (b2019060511)
Java: Azul Systems, Inc. 11.0.3

Am I just misunderstanding this? Shouldn't I be getting a result set, and shouldn't it be writing to the tag?

You are using the system.runUpdateQuery() which is expecting just an integer value of the number of rows updated.
Try using system.db.runQuery().

2 Likes

You my friend are awesome! Thank you!