 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Zé Paulo Guest
|
Posted: Fri Feb 25, 2005 9:44 am Post subject: How to make a query in run time? |
|
|
Hello
I want to Do updates in Oracle DB Using Delphi at run Time!
How can I Put de names of the tables and of the fields in the SQL commad?
My problem are With "table_name","column_name" and "parameter"!
I have this procedure:
procedure UpdateDB(query: TQuery; table_name, column_name, parameter, param_value, value: String);
Begin
With query do begin
with SQL do begin
query.Close;
SQL.Clear;
Add('UPDATE "table_name" SET "column_name"=:value WHERE "parameter"=:param_value');
query.ParamByName('value').AsString := value;
query.ParamByName('param_value').AsString := param_value;
query.Prepare;
query.ExecSQL;
End;
End;
End.
Errors:
Table does not exist or Invalid field Name
Thanks
|
|
| Back to top |
|
 |
Sunil Furtado Guest
|
Posted: Fri Feb 25, 2005 10:50 am Post subject: Re: How to make a query in run time? |
|
|
Try
add('update '+table_name+' set '+colunm_name+'=:value') etc
Sunil
| Quote: | procedure UpdateDB(query: TQuery; table_name, column_name, parameter,
param_value, value: String);
Begin
With query do begin
with SQL do begin
query.Close;
SQL.Clear;
Add('UPDATE "table_name" SET "column_name"=:value WHERE
"parameter"=:param_value');
query.ParamByName('value').AsString := value;
query.ParamByName('param_value').AsString := param_value;
query.Prepare;
query.ExecSQL;
End;
End;
End.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|