I'm trying to execute a basic SQL query.
This is the code I'm using:
mq="SELECT MeltCount FROM M7Pour WHERE MeltCount>?"
data=system.db.runPrepQuery(mq,4)
This generates the error:
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepQuery(SELECT MeltCount FROM M7Pour WHERE MeltCount>?, , [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], )
I've tried converting my search (the 4 in the above code) to float, int, and string, but still get errors.
When I change my code to this:
mq="SELECT MeltCount FROM M7Pour WHERE MeltCount>4"
data=system.db.runPrepQuery(mq)
I don't get any errors and it returns the data I want. Is there some casting I need to do in my query or conversion I need to do for the value I'm searching? In the meantime I can add my search to the string being queried, but this seems like an unfortunate workaround.