InvalidOperationException
The command is in an invalid state. Either the ULCommand.Connection value is missing or closed, the ULCommand.Transaction
value does not match the current transaction state of the connection, or the ULCommand.CommandText value is invalid.
The statement is the current ULCommand object, with the ULCommand.CommandText value and any ULCommand.Parameters value as
required.
If this method is called on a query that returns multiple rows and columns, only the first column of the first row is returned.
If the ULCommand.CommandType value is System.Data.CommandType.TableDirect, the ExecuteScalar method performs a ULCommand.ExecuteTable
call and returns the first column of the first row.
SELECT statements are marked as read-only by default for performance reasons. If the query is going to be used to make updates,
the statement must end with " FOR UPDATE".