SQLQuery has the following parameters:
SQL.Strings = (
‘SELECT’
‘ trans_request.id, ’
‘ trans_request.req_date, ’
‘ trans_request.customer, ’
‘ trans_request.trans_type, ’
‘ trans_request.comment, ’
‘ trans_request.vehicle_id, ’
‘ trans_request.start_kms, ’
‘ trans_request.finish_kms, ’
‘ trans_request.driver_id, ’
‘ trans_request.driver_report, ’
‘ trans_request.path_photo, ’
‘ trans_request.vehicle_type, ’
‘ trans_request.start_dtime, ’
‘ trans_request.finish_dtime, ’
‘ trans_request.distance’
‘FROM trans_request’
‘ORDER BY trans_request.req_date DESC’
)
InsertSQL.Strings = (
‘INSERT INTO trans_request’
‘ (’
‘ trans_request.req_date, ’
‘ trans_request.customer, ’
‘ trans_request.trans_type, ’
‘ trans_request.comment, ’
‘ trans_request.vehicle_id, ’
‘ trans_request.start_kms, ’
‘ trans_request.finish_kms, ’
‘ trans_request.driver_id, ’
‘ trans_request.driver_report, ’
‘ trans_request.path_photo, ’
‘ trans_request.vehicle_type, ’
‘ trans_request.start_dtime, ’
‘ trans_request.finish_dtime’
‘ )’
‘VALUES’
‘ (:id, ’
‘ :req_date, ’
‘ :customer, ’
‘ :trans_type, ’
‘ :comment, ’
‘ :vehicle_id, ’
‘ :start_kms, ’
‘ :finish_kms, ’
‘ :driver_id, ’
‘ :driver_report, ’
‘ :path_photo, ’
‘ :vehicle_type, ’
‘ :start_dtime, ’
‘ :finish_dtime, ’
‘ :distance’
‘ )’
)
UpdateSQL.Strings = (
‘UPDATE trans_request’
‘SET’
‘ trans_request.req_date = :req_date,’
‘ trans_request.customer = :customer, ’
‘ trans_request.trans_type = :trans_type, ’
‘ trans_request.comment = :comment, ’
‘ trans_request.vehicle_id = :vehicle_id, ’
‘ trans_request.start_kms = :start_kms, ’
‘ trans_request.finish_kms = :finish_kms, ’
‘ trans_request.driver_id = :driver_id, ’
‘ trans_request.driver_report = :driver_report, ’
‘ trans_request.path_photo = :path_photo, ’
‘ trans_request.vehicle_type = :vehicle_type, ’
‘ trans_request.start_dtime = :start_dtime, ’
‘ trans_request.finish_dtime = :finish_dtime’
‘WHERE’
‘ (trans_request.id = :OLD_id)’
‘ ’
)
Options = [sqoKeepOpenOnCommit, sqoAutoApplyUpdates, sqoAutoCommit]
ParseSQL = False
When executing Post after fields edited, an error occurs:
Operation not allowed, dataset ‘tbTransReq’ is not in an edit or insert state.
If you write only SQL.Strings, leave UpdateSQL.Strings, InsertSQL.Strings and all other SQL empty, and set ParseSQL = True, everything works fine.
This is a simple SQL query, and I can use the second method, but I want to make a complex query that the parser cannot handle.
Then I need UpdateSQL.Strings, InsertSQL.Strings, and all other SQL.
What am I doing wrong?