Board index » delphi » SQL error "list out of bounds"

SQL error "list out of bounds"

Can anyone tell me why I get a "list out of bounds (0)" error for the
following:

var Qvar: integer;

Query1.Close;
Query1.SQL.Clear;
 Query1.Params[0].AsInteger:= Qvar;

 

Re:SQL error "list out of bounds"


On Fri, 20 Apr 2001 20:59:59 -0400, "George Kuascha"

Quote
<gkho...@hotmail.com> wrote:
>Can anyone tell me why I get a "list out of bounds (0)" error for the
>following:

>var Qvar: integer;

>Query1.Close;
>Query1.SQL.Clear;
> Query1.Params[0].AsInteger:= Qvar;

Since you've cleared the SQL, there are no parameters in existence,
not even the 0th one.   You need to enter the new SQL text including
parameter identifiers before you set the param values.   Incidentally
it is safer and more maintainable to refer to the params using
ParamByName.

regards
Colin Acheson

Re:SQL error "list out of bounds"


After you call Clear there is no SQL statement, therefore, there are no
parameters.

--
Bill

Other Threads