I have defined a query in SQLite database. Its an INSERT query with input parameters. This is defined in the database.
With UniDAC, how can I pass parameters to and run this query?
or is it not possible and the only possibilities are to use UniQuery with INSERT statement in the SQL or UniConnection.ExceSQL with INSERT statement?
How to call SQLite Insert query?
Hello,
Databases does not support “storing the INSERT statements”. Many databases use stored procedures and functions for this purpose, however SQLite does not support this feature. Thats why you should use parameterized queries with such UniDAC components as UniQuery or UniSQL.
For example:
Databases does not support “storing the INSERT statements”. Many databases use stored procedures and functions for this purpose, however SQLite does not support this feature. Thats why you should use parameterized queries with such UniDAC components as UniQuery or UniSQL.
For example:
Code: Select all
var
UniQuery: TUniQuery;
begin
UniQuery:= TUniQuery.Create(nil);
UniQuery.Connection := UniConnection1;
UniQuery.Sql.Text := 'INSERT INTO T_TEST(F_ID, F_DATE) VALUES(:ID, :DATE)';
UniQuery.Prepare;
UniQuery.ParamByName('ID').DataType := ftInteger;
UniQuery.ParamByName('ID').ParamType := ptInput;
UniQuery.ParamByName('BILLDATE').DataType := ftInteger;
UniQuery.ParamByName('BILLDATE').ParamType := ptInput;
UniQuery.ParamByName('ID').AsInteger := 1;
UniQuery.ParamByName('BILLDATE').AsDate := now;
UniQuery.Execute;
