Hi
I'm trying to understand how the SQL, SQLInsert, SQLUpdate and SQLDelete works in the TUniQuery. In the main SQL I have the Select SQL statement but can I have an insert, update or delete SQL as well without using separate TUniQuery objects? I need this for a web app in Elevate Web Builder and I have to specify SQL statements for Select, Insert, Update and Delete. After I have generated the SQL statements for Insert, Update and Delte, only the parameters for the main SQL statements is visible. How do I set the params for these other SQL statements and how to I specifically execute each of them? For Example, how to I assigne params and execute the SQLUpdate?
Thanks and best regards
Eivind
SQLInsert, SQLUpdate, etc
Re: SQLInsert, SQLUpdate, etc
You can use the usual methods of Append, Edit, Post when working with UniQuery. After all, using properties such as SQLDelete, SQLInsert, SQLUpdate is not mandatory. You can check it by yourself,
specifying in the UniQuery.SQL property the simplest query as follows: Select * From TABLENAME. For example, when executing the Append method, in this query there will be data insertion into the TABLENAME table, even without specifying the SQLInsert property value. In this case, UniDAC will generate a query for inserting by itself.
To update data using parameters, you can use the following approach:
specifying in the UniQuery.SQL property the simplest query as follows: Select * From TABLENAME. For example, when executing the Append method, in this query there will be data insertion into the TABLENAME table, even without specifying the SQLInsert property value. In this case, UniDAC will generate a query for inserting by itself.
To update data using parameters, you can use the following approach:
Code: Select all
UniQuery.SQL.Text := 'Update DEPT Set Loc = :Param1 Where DEPTNO=:Param2';
UniQuery.ParamByName('Param1').AsString := 'Barcelona';
UniQuery.ParamByName('Param1').AsInteger := 10;
UniQuery.Execute;