Board index » delphi » TADOQuery update probloms

TADOQuery update probloms

hi

I have no problom TADOQuery insert/delete

I have problom TADOQuery update.
I'm Crazy.

I worked : window2000 Server , Oracle7.3, MDAC 2.5
               TADOConnection, TADOQuery, TDataSource, TDBGrid

      with FSomoDM.ADOQ_SCODE do
      begin
        Close;
        SQL.Clear;
        SQL.Add('UPDATE SOMOSCODE');
        SQL.Add('SET SOMOCCODE=:G1,');
        SQL.Add('    SOMOSCODE=:G2,');
        SQL.Add('    SOMOSNAME=:G3');
        SQL.Add('where SOMOCCODE=:G1 AND SOMOSCODE=:G2');
        Parameters.ParamValues['G1'] :=
FSomoDM.ADOQ_CCODE.FieldByName('SOMOCCODE').AsString;
        Parameters.ParamValues['G2'] := Edit1.Text;
        Parameters.ParamValues['G3'] := Edit2.Text;
        ExecSQL;
      end;

help me! thanks!

 

Re:TADOQuery update probloms


It appears that you can't add SQL in stages with ADO. You must assign it in
one go.

Martijn Houtman

Quote
"jaewon choi" <del...@iconds.com> wrote in message

news:3a2475a8$1_1@dnews...
Quote
> hi

> I have no problom TADOQuery insert/delete

> I have problom TADOQuery update.
> I'm Crazy.

> I worked : window2000 Server , Oracle7.3, MDAC 2.5
>                TADOConnection, TADOQuery, TDataSource, TDBGrid

>       with FSomoDM.ADOQ_SCODE do
>       begin
>         Close;
>         SQL.Clear;
>         SQL.Add('UPDATE SOMOSCODE');
>         SQL.Add('SET SOMOCCODE=:G1,');
>         SQL.Add('    SOMOSCODE=:G2,');
>         SQL.Add('    SOMOSNAME=:G3');
>         SQL.Add('where SOMOCCODE=:G1 AND SOMOSCODE=:G2');
>         Parameters.ParamValues['G1'] :=
> FSomoDM.ADOQ_CCODE.FieldByName('SOMOCCODE').AsString;
>         Parameters.ParamValues['G2'] := Edit1.Text;
>         Parameters.ParamValues['G3'] := Edit2.Text;
>         ExecSQL;
>       end;

> help me! thanks!

Re:TADOQuery update probloms


The ADO datasets parse the SQL statements when you assign the SQL
statements.  If you are building the SQL statement in stages, the you
should assign it to a string variable and then assign that string to
the dataset when it's completely built.

On Wed, 29 Nov 2000 12:29:14 +0900, "jaewon choi" <del...@iconds.com>
wrote:

Quote
>hi

>I have no problom TADOQuery insert/delete

>I have problom TADOQuery update.
>I'm Crazy.

>I worked : window2000 Server , Oracle7.3, MDAC 2.5
>               TADOConnection, TADOQuery, TDataSource, TDBGrid

>      with FSomoDM.ADOQ_SCODE do
>      begin
>        Close;
>        SQL.Clear;
>        SQL.Add('UPDATE SOMOSCODE');
>        SQL.Add('SET SOMOCCODE=:G1,');
>        SQL.Add('    SOMOSCODE=:G2,');
>        SQL.Add('    SOMOSNAME=:G3');
>        SQL.Add('where SOMOCCODE=:G1 AND SOMOSCODE=:G2');
>        Parameters.ParamValues['G1'] :=
>FSomoDM.ADOQ_CCODE.FieldByName('SOMOCCODE').AsString;
>        Parameters.ParamValues['G2'] := Edit1.Text;
>        Parameters.ParamValues['G3'] := Edit2.Text;
>        ExecSQL;
>      end;

>help me! thanks!

Chris Miller
VersaTrans Routing and Planning Software
VersaTrans, Inc.

Re:TADOQuery update probloms


Hi
i think your problem is in the parameters
try to assign Parameters[0].Value := ......... until Parameters[3].Value :=
becouse by name I belive it's a problem when 2 parameters has the same name
you ment it to be the same parametr  but I'm not sure it is so with Delphi

David

Quote
"jaewon choi" <del...@iconds.com> wrote in message

news:3a2475a8$1_1@dnews...
Quote
> hi

> I have no problom TADOQuery insert/delete

> I have problom TADOQuery update.
> I'm Crazy.

> I worked : window2000 Server , Oracle7.3, MDAC 2.5
>                TADOConnection, TADOQuery, TDataSource, TDBGrid

>       with FSomoDM.ADOQ_SCODE do
>       begin
>         Close;
>         SQL.Clear;
>         SQL.Add('UPDATE SOMOSCODE');
>         SQL.Add('SET SOMOCCODE=:G1,');
>         SQL.Add('    SOMOSCODE=:G2,');
>         SQL.Add('    SOMOSNAME=:G3');
>         SQL.Add('where SOMOCCODE=:G1 AND SOMOSCODE=:G2');
>         Parameters.ParamValues['G1'] :=
> FSomoDM.ADOQ_CCODE.FieldByName('SOMOCCODE').AsString;
>         Parameters.ParamValues['G2'] := Edit1.Text;
>         Parameters.ParamValues['G3'] := Edit2.Text;
>         ExecSQL;
>       end;

> help me! thanks!

Other Threads