Subject | RE: [ib-support] Query question |
---|---|
Author | Nico Callewaert |
Post date | 2001-06-01T05:02:20Z |
Thanks Lucas,
But the problem is, the next ItemNo is not always CurrItemNo + 1....
Nico
-----Oorspronkelijk bericht-----
Van: Lucas Franzen [mailto:luc@...]
Verzonden: donderdag 31 mei 2001 21:04
Aan: ib-support@yahoogroups.com
Onderwerp: Re: [ib-support] Query question
Nico,
since I know you use IBObjects you can use a TIB_query for that, setting
the MaxRows property to 1.
As SQL you can use sth. like:
SELECT xxxxxxx FROM xxxxxxx
WHERE ItemNo > :qItemNo
ORDER BY ItemNo
Now you can still use your current value, like:
procedure getNextRec;
var currID: Integer;
begin
with mySingleQuery do
begin
currID := FieldByName ( 'ItemNo' ).AsInteger;
ParamByName := currID + 1;
// with RefreshOnParamChange set to TRUE that should be all
end;
end;
for getting the previous one, you'd need a second query (or change the
SQL).
HTH
Luc.
Nico Callewaert schrieb:
with the down arrow of the keyboard and go to the previous record with the
up arrow. I don't like to use a SELECT * FROM ... query to accomplish
this, because I know it's better to use parameterized queries. My query
looks like this : SELECT xxxxxxx FROM xxxxxxx WHERE ItemNo = :qItemNo. The
problem now is : how could I know the primary key value of the next record ?
The next record is not always : Current record + 1. Because the current
ItemNo can be 100 and the next 102. I did it like this : I use a stored
procedure with a syntax :
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
But the problem is, the next ItemNo is not always CurrItemNo + 1....
Nico
-----Oorspronkelijk bericht-----
Van: Lucas Franzen [mailto:luc@...]
Verzonden: donderdag 31 mei 2001 21:04
Aan: ib-support@yahoogroups.com
Onderwerp: Re: [ib-support] Query question
Nico,
since I know you use IBObjects you can use a TIB_query for that, setting
the MaxRows property to 1.
As SQL you can use sth. like:
SELECT xxxxxxx FROM xxxxxxx
WHERE ItemNo > :qItemNo
ORDER BY ItemNo
Now you can still use your current value, like:
procedure getNextRec;
var currID: Integer;
begin
with mySingleQuery do
begin
currID := FieldByName ( 'ItemNo' ).AsInteger;
ParamByName := currID + 1;
// with RefreshOnParamChange set to TRUE that should be all
end;
end;
for getting the previous one, you'd need a second query (or change the
SQL).
HTH
Luc.
Nico Callewaert schrieb:
>server. Now a user is asking if it is possible to go to the next record
> Hi all,
>
> I have a parameterized query that retrieves just 1 record from the
with the down arrow of the keyboard and go to the previous record with the
up arrow. I don't like to use a SELECT * FROM ... query to accomplish
this, because I know it's better to use parameterized queries. My query
looks like this : SELECT xxxxxxx FROM xxxxxxx WHERE ItemNo = :qItemNo. The
problem now is : how could I know the primary key value of the next record ?
The next record is not always : Current record + 1. Because the current
ItemNo can be 100 and the next 102. I did it like this : I use a stored
procedure with a syntax :
>record on the screen and get the next higher value */
> FOR SELECT ItemNo FROM Items
> WHERE ItemNo > :pItemNo /* As parameter I use the value of the
> DOthat ?
> BEGIN
> SUSPEND;
> EXIT;
> END
>
> So only the next value is transferred. Is this the preferred way to to
>To unsubscribe from this group, send an email to:
> Many thanks,
>
> Nico Callewaert
>
> [Non-text portions of this message have been removed]
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/