Hi
I would like to know how to issue 3 simple UPDATE statements to the database.
For example:
If the use has checked a checkbox then
begin
UPDATE set OK_TO_USE_FLAG = 'Y'
where key like '3142%';
UPDATE set OK_TO_USE_FLAG = 'Y'
where key like '3142%';
UPDATE set OK_TO_USE_FLAG = 'Y'
where key like '3142%';
commit;
end;
There is no matching select so I am not sure if TORAQUERY is correct.
Can you please give step by step statements in your response.
Thank you!
Simple Update statement
You can use a code like the following:
Code: Select all
OraQuery.AutoCommit := False;
OraQuery.SQL.Text := 'UPDATE set OK_TO_USE_FLAG = ''Y'' where key like ''3142%''';
OraQuery.Execute;
OraQuery.SQL.Text := 'UPDATE set OK_TO_USE_FLAG = ''Y'' where key like ''3142%''';
OraQuery.Execute;
OraQuery.SQL.Text := 'UPDATE set OK_TO_USE_FLAG = ''Y'' where key like ''3142%''';
OraQuery.Execute;
OraSession.Commit;Thank you for the response.
I received an error
"Cannot perform this operation on a closed dataset"
When I added that which I thought natural ie
OraQ.Open;
Then I received an error
"Sql statment does not return any rows"
Intuitively I feel that OraQ.Sql.Text is for queries (which the error appears to confirm). What is Oraq.SQLUpdate used for? .. and how can I solve the "Cannot perform this operation on a closed dataset"
problem?
Thanks again
I received an error
"Cannot perform this operation on a closed dataset"
When I added that which I thought natural ie
OraQ.Open;
Then I received an error
"Sql statment does not return any rows"
Intuitively I feel that OraQ.Sql.Text is for queries (which the error appears to confirm). What is Oraq.SQLUpdate used for? .. and how can I solve the "Cannot perform this operation on a closed dataset"
problem?
Thanks again
You can assign an UPDATE statement to SQL property of TOraQuery. In that case you should call Execute method instead of Open to execute the statement. The code from my previous post should not raise the error "Cannot perform this operation on a closed dataset".
You should debug your code to detect what line of the code raises this error.
SQLUpdate property is used when editing a result SELECT statement.
You should debug your code to detect what line of the code raises this error.
SQLUpdate property is used when editing a result SELECT statement.