Board index » delphi » how to handle TQuery Error and ms sql 6.5

how to handle TQuery Error and ms sql 6.5

I have a dimamic tquery with ms sql 6.5 like:

..
query.sql.clear;
query.sql.add(MyQuery);
query.prepare;
try
  query.open;
except
  error := true;
end;
if not error then begin

  query.close
end;
query.unprepare;
...

if the sintax of  MyQuery is rong or is not a valid quary, the application
Hang's on unprepare.

AnyOne have a solution for these.
Please EMail me h...@mail.telepac.pt

 

Re:how to handle TQuery Error and ms sql 6.5


On 1 Oct 1996 13:10:53 GMT, "Hugo Ribas Pacheco" <h...@mail.telepac.pt>
you smacked the keyboard repeatedly to write:

Quote
>I have a dimamic tquery with ms sql 6.5 like:

>..
>query.sql.clear;
>query.sql.add(MyQuery);
>query.prepare;
>try
>  query.open;
>except
>  error := true;
>end;
>if not error then begin

>  query.close
>end;
>query.unprepare;
>...

>if the sintax of  MyQuery is rong or is not a valid quary, the application
>Hang's on unprepare.

Your query.unprepare should be inside the IF like this:

        if not error then begin
                query.close;
                query.unprepare;
        end;

Brien King
bk...@primenet.com

Re:how to handle TQuery Error and ms sql 6.5


Brien King <bk...@primenet.com> wrote in article
<3251514a.74418078@news>...

Quote
> On 1 Oct 1996 13:10:53 GMT, "Hugo Ribas Pacheco" <h...@mail.telepac.pt>
> you smacked the keyboard repeatedly to write:

> >I have a dimamic tquery with ms sql 6.5 like:

> >..
> >query.sql.clear;
> >query.sql.add(MyQuery);
> >query.prepare;
> >try
> >  query.open;
> >except
> >  error := true;
> >end;
> >if not error then begin

> >  query.close
> >end;
> >query.unprepare;
> >...

> >if the sintax of  MyQuery is rong or is not a valid quary, the
application
> >Hang's on unprepare.

> Your query.unprepare should be inside the IF like this:

>    if not error then begin
>            query.close;
>            query.unprepare;
>    end;

> Brien King
> bk...@primenet.com

i don't think so because, if i do that, when i call that function it hangs
on the prepare..

HELP me

Other Threads