How to make a query in run time?

From: Zé Paulo (jmartins_at_telbit.pt)
Date: 02/25/05


Date: 25 Feb 2005 01:44:14 -0800


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



Relevant Pages

  • Re: Why .NET vs. Win32?
    ... > a steam engine that is both heavy, under performing and pollutes more, ... - They get more customers, because when they persuade Delphi coders to switch to Delphi .net, it's a small step to switch to C#. ... Several security updates caused more trouble than they were worth. ... Unknown backdoors, making .net possibly a Western-world only thing as soon as the Chinese find backdoors in it (like the ...
    (borland.public.delphi.non-technical)
  • Re: Delphi bugs and "moving" to Visual Studio debate
    ... mention to them that Delphi is named Delphi because it was to ... development environment for Oracle, ... item 3 (database) is the primary factor for decisions. ... > clients don't even know about any bugs etc in IDE's before they decide ...
    (borland.public.delphi.non-technical)
  • Re: Reaction to Q2 Warning
    ... it doesn't have to run on anything but client machines connecting to an Oracle server. ... AFIAK, Sun doesn't sell a database so Delphi is pretty much useless for Sun. IMO, an acquisition by Sun has the highest likelihood of killing Delphi. ...
    (borland.public.delphi.non-technical)
  • Re: oracle 9 on solaris 8 - exception reporting
    ... Sybrand gave the correct response to find what a particular problem ... because it can't handle such long response times from Oracle. ... We do a series of 4 inserts and updates and just have a total time ...
    (comp.databases.oracle.server)
  • Re: Microsoft Release VS2003 SP1
    ... many Updates did Delphi 7, 2005, 2006 have when it was still relevant? ... I believe fixing bugs early on should be ... considered better customer support, instead of fixing bugs to products ...
    (borland.public.delphi.non-technical)