Board index » delphi » DBGrid / Display records

DBGrid / Display records

Hello,

I have to display records of a Paradox table "in inverted order" in a DBGrid
(Delphi 3).
I use a secondary index with the same fields as the primary one, and check
"Descending" in the index properties.

But now, when I edit a field, and then ask for the next record, instead of
going to the next one, it goes to the last one.
Also, sometimes, when I go through the grid, it goes "up" when I asked
"down"

So how can I display records "in inverted order", and still navigate
as usual (that means logicaly compared to the display) through records ?

Valerie.

 

Re:DBGrid / Display records


Have you tried a TQuery like:

SELECT *
FROM Table
ORDER BY Field DESC

"V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
news:8deus0$9ed$1@wanadoo.fr...

Quote
> Hello,

> I have to display records of a Paradox table "in inverted order" in a
DBGrid
> (Delphi 3).
> I use a secondary index with the same fields as the primary one, and check
> "Descending" in the index properties.

> But now, when I edit a field, and then ask for the next record, instead of
> going to the next one, it goes to the last one.
> Also, sometimes, when I go through the grid, it goes "up" when I asked
> "down"

> So how can I display records "in inverted order", and still navigate
> as usual (that means logicaly compared to the display) through records ?

> Valerie.

Re:DBGrid / Display records


No, but it's a DBGrid that is used to create data, not just display them, so
a TQuery isn't the best solution I guess ?
I can't insert records in a TQuery ?

Anyway, I'll think about it.

Valerie.

M.H. Avegaart <avega...@NOSPAMmccomm.nl> a crit dans le message :
8dfa49$pf...@porthos.nl.uu.net...

Quote
> Have you tried a TQuery like:

> SELECT *
> FROM Table
> ORDER BY Field DESC

> "V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
> news:8deus0$9ed$1@wanadoo.fr...
> > Hello,

> > I have to display records of a Paradox table "in inverted order" in a
> DBGrid
> > (Delphi 3).
> > I use a secondary index with the same fields as the primary one, and
check
> > "Descending" in the index properties.

> > But now, when I edit a field, and then ask for the next record, instead
of
> > going to the next one, it goes to the last one.
> > Also, sometimes, when I go through the grid, it goes "up" when I asked
> > "down"

> > So how can I display records "in inverted order", and still navigate
> > as usual (that means logicaly compared to the display) through records ?

> > Valerie.

Re:DBGrid / Display records


Yes, you can. You should either set RequestLive to True or, if that is not
possible, set UpdateObject to a new TUpdateSQL.

"V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
news:8dfak6$plm$1@wanadoo.fr...

Quote
> No, but it's a DBGrid that is used to create data, not just display them,
so
> a TQuery isn't the best solution I guess ?
> I can't insert records in a TQuery ?

> Anyway, I'll think about it.

> Valerie.

> M.H. Avegaart <avega...@NOSPAMmccomm.nl> a crit dans le message :
> 8dfa49$pf...@porthos.nl.uu.net...
> > Have you tried a TQuery like:

> > SELECT *
> > FROM Table
> > ORDER BY Field DESC

> > "V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
> > news:8deus0$9ed$1@wanadoo.fr...
> > > Hello,

> > > I have to display records of a Paradox table "in inverted order" in a
> > DBGrid
> > > (Delphi 3).
> > > I use a secondary index with the same fields as the primary one, and
> check
> > > "Descending" in the index properties.

> > > But now, when I edit a field, and then ask for the next record,
instead
> of
> > > going to the next one, it goes to the last one.
> > > Also, sometimes, when I go through the grid, it goes "up" when I asked
> > > "down"

> > > So how can I display records "in inverted order", and still navigate
> > > as usual (that means logicaly compared to the display) through records
?

> > > Valerie.

Re:DBGrid / Display records


A DBGrid simply displays the contents of the underlying table or query.
Whatever order the records are in, that's how they'll display.

As to your original question, perhaps the descending index you created isn't
the active index.  You can make it so by setting the IndexName property of
the table.

Paul / ColumbuSoft
www.columbusoft.com

Quote
V. Bernhardt <geocons...@wanadoo.fr> wrote in message

news:8dfak6$plm$1@wanadoo.fr...
Quote
> No, but it's a DBGrid that is used to create data, not just display them,
so
> a TQuery isn't the best solution I guess ?
> I can't insert records in a TQuery ?

> Anyway, I'll think about it.

> Valerie.

> M.H. Avegaart <avega...@NOSPAMmccomm.nl> a crit dans le message :
> 8dfa49$pf...@porthos.nl.uu.net...
> > Have you tried a TQuery like:

> > SELECT *
> > FROM Table
> > ORDER BY Field DESC

> > "V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
> > news:8deus0$9ed$1@wanadoo.fr...
> > > Hello,

> > > I have to display records of a Paradox table "in inverted order" in a
> > DBGrid
> > > (Delphi 3).
> > > I use a secondary index with the same fields as the primary one, and
> check
> > > "Descending" in the index properties.

> > > But now, when I edit a field, and then ask for the next record,
instead
> of
> > > going to the next one, it goes to the last one.
> > > Also, sometimes, when I go through the grid, it goes "up" when I asked
> > > "down"

> > > So how can I display records "in inverted order", and still navigate
> > > as usual (that means logicaly compared to the display) through records
?

> > > Valerie.

Re:DBGrid / Display records


The descending index is the active one.
It's when I set the descending index to the active one that navigation in
the DBGrid started to become "odd".

Valerie.

Paul Ferrara <p...@nospam.columbusoft.com> a crit dans le message :
8dgt1o21...@news1.newsguy.com...

Quote
> A DBGrid simply displays the contents of the underlying table or query.
> Whatever order the records are in, that's how they'll display.

> As to your original question, perhaps the descending index you created
isn't
> the active index.  You can make it so by setting the IndexName property of
> the table.

> Paul / ColumbuSoft
> www.columbusoft.com

> V. Bernhardt <geocons...@wanadoo.fr> wrote in message
> news:8dfak6$plm$1@wanadoo.fr...
> > No, but it's a DBGrid that is used to create data, not just display
them,
> so
> > a TQuery isn't the best solution I guess ?
> > I can't insert records in a TQuery ?

> > Anyway, I'll think about it.

> > Valerie.

> > M.H. Avegaart <avega...@NOSPAMmccomm.nl> a crit dans le message :
> > 8dfa49$pf...@porthos.nl.uu.net...
> > > Have you tried a TQuery like:

> > > SELECT *
> > > FROM Table
> > > ORDER BY Field DESC

> > > "V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
> > > news:8deus0$9ed$1@wanadoo.fr...
> > > > Hello,

> > > > I have to display records of a Paradox table "in inverted order" in
a
> > > DBGrid
> > > > (Delphi 3).
> > > > I use a secondary index with the same fields as the primary one, and
> > check
> > > > "Descending" in the index properties.

> > > > But now, when I edit a field, and then ask for the next record,
> instead
> > of
> > > > going to the next one, it goes to the last one.
> > > > Also, sometimes, when I go through the grid, it goes "up" when I
asked
> > > > "down"

> > > > So how can I display records "in inverted order", and still navigate
> > > > as usual (that means logicaly compared to the display) through
records
> ?

> > > > Valerie.

Re:DBGrid / Display records


I'll try it.
Thank you.

Valerie.

M.H. Avegaart <avega...@NOSPAMmccomm.nl> a crit dans le message :
8dgvnd$ds...@porthos.nl.uu.net...

Quote
> Yes, you can. You should either set RequestLive to True or, if that is not
> possible, set UpdateObject to a new TUpdateSQL.

> "V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
> news:8dfak6$plm$1@wanadoo.fr...
> > No, but it's a DBGrid that is used to create data, not just display
them,
> so
> > a TQuery isn't the best solution I guess ?
> > I can't insert records in a TQuery ?

> > Anyway, I'll think about it.

> > Valerie.

> > M.H. Avegaart <avega...@NOSPAMmccomm.nl> a crit dans le message :
> > 8dfa49$pf...@porthos.nl.uu.net...
> > > Have you tried a TQuery like:

> > > SELECT *
> > > FROM Table
> > > ORDER BY Field DESC

> > > "V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
> > > news:8deus0$9ed$1@wanadoo.fr...
> > > > Hello,

> > > > I have to display records of a Paradox table "in inverted order" in
a
> > > DBGrid
> > > > (Delphi 3).
> > > > I use a secondary index with the same fields as the primary one, and
> > check
> > > > "Descending" in the index properties.

> > > > But now, when I edit a field, and then ask for the next record,
> instead
> > of
> > > > going to the next one, it goes to the last one.
> > > > Also, sometimes, when I go through the grid, it goes "up" when I
asked
> > > > "down"

> > > > So how can I display records "in inverted order", and still navigate
> > > > as usual (that means logicaly compared to the display) through
records
> ?

> > > > Valerie.

Re:DBGrid / Display records


If you're using a TQuery, that's your problem since you can't specify which
index (if any) it will use.  In that case use the Order By clause.

Paul / ColumbuSoft
www.columbusoft.com

Quote
V. Bernhardt <geocons...@wanadoo.fr> wrote in message

news:8dhb1r$mct$1@wanadoo.fr...
Quote
> The descending index is the active one.
> It's when I set the descending index to the active one that navigation in
> the DBGrid started to become "odd".

> Valerie.

> Paul Ferrara <p...@nospam.columbusoft.com> a crit dans le message :
> 8dgt1o21...@news1.newsguy.com...
> > A DBGrid simply displays the contents of the underlying table or query.
> > Whatever order the records are in, that's how they'll display.

> > As to your original question, perhaps the descending index you created
> isn't
> > the active index.  You can make it so by setting the IndexName property
of
> > the table.

> > Paul / ColumbuSoft
> > www.columbusoft.com

> > V. Bernhardt <geocons...@wanadoo.fr> wrote in message
> > news:8dfak6$plm$1@wanadoo.fr...
> > > No, but it's a DBGrid that is used to create data, not just display
> them,
> > so
> > > a TQuery isn't the best solution I guess ?
> > > I can't insert records in a TQuery ?

> > > Anyway, I'll think about it.

> > > Valerie.

> > > M.H. Avegaart <avega...@NOSPAMmccomm.nl> a crit dans le message :
> > > 8dfa49$pf...@porthos.nl.uu.net...
> > > > Have you tried a TQuery like:

> > > > SELECT *
> > > > FROM Table
> > > > ORDER BY Field DESC

> > > > "V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
> > > > news:8deus0$9ed$1@wanadoo.fr...
> > > > > Hello,

> > > > > I have to display records of a Paradox table "in inverted order"
in
> a
> > > > DBGrid
> > > > > (Delphi 3).
> > > > > I use a secondary index with the same fields as the primary one,
and
> > > check
> > > > > "Descending" in the index properties.

> > > > > But now, when I edit a field, and then ask for the next record,
> > instead
> > > of
> > > > > going to the next one, it goes to the last one.
> > > > > Also, sometimes, when I go through the grid, it goes "up" when I
> asked
> > > > > "down"

> > > > > So how can I display records "in inverted order", and still
navigate
> > > > > as usual (that means logicaly compared to the display) through
> records
> > ?

> > > > > Valerie.

Re:DBGrid / Display records


Thank you for your answers.
No, I don't use a TQuery. I use a TTable.
But answers to my question say I should try with a TQuery.
So I'll have a try because that's the only solution that was suggested to
me.

Valerie.

Paul Ferrara <p...@nospam.columbusoft.com> a crit dans le message :
8dj5vs11...@news1.newsguy.com...

Quote
> If you're using a TQuery, that's your problem since you can't specify
which
> index (if any) it will use.  In that case use the Order By clause.

> Paul / ColumbuSoft
> www.columbusoft.com

> V. Bernhardt <geocons...@wanadoo.fr> wrote in message
> news:8dhb1r$mct$1@wanadoo.fr...
> > The descending index is the active one.
> > It's when I set the descending index to the active one that navigation
in
> > the DBGrid started to become "odd".

> > Valerie.

> > Paul Ferrara <p...@nospam.columbusoft.com> a crit dans le message :
> > 8dgt1o21...@news1.newsguy.com...
> > > A DBGrid simply displays the contents of the underlying table or
query.
> > > Whatever order the records are in, that's how they'll display.

> > > As to your original question, perhaps the descending index you created
> > isn't
> > > the active index.  You can make it so by setting the IndexName
property
> of
> > > the table.

> > > Paul / ColumbuSoft
> > > www.columbusoft.com

> > > V. Bernhardt <geocons...@wanadoo.fr> wrote in message
> > > news:8dfak6$plm$1@wanadoo.fr...
> > > > No, but it's a DBGrid that is used to create data, not just display
> > them,
> > > so
> > > > a TQuery isn't the best solution I guess ?
> > > > I can't insert records in a TQuery ?

> > > > Anyway, I'll think about it.

> > > > Valerie.

> > > > M.H. Avegaart <avega...@NOSPAMmccomm.nl> a crit dans le message :
> > > > 8dfa49$pf...@porthos.nl.uu.net...
> > > > > Have you tried a TQuery like:

> > > > > SELECT *
> > > > > FROM Table
> > > > > ORDER BY Field DESC

> > > > > "V. Bernhardt" <geocons...@wanadoo.fr> schreef in bericht
> > > > > news:8deus0$9ed$1@wanadoo.fr...
> > > > > > Hello,

> > > > > > I have to display records of a Paradox table "in inverted order"
> in
> > a
> > > > > DBGrid
> > > > > > (Delphi 3).
> > > > > > I use a secondary index with the same fields as the primary one,
> and
> > > > check
> > > > > > "Descending" in the index properties.

> > > > > > But now, when I edit a field, and then ask for the next record,
> > > instead
> > > > of
> > > > > > going to the next one, it goes to the last one.
> > > > > > Also, sometimes, when I go through the grid, it goes "up" when I
> > asked
> > > > > > "down"

> > > > > > So how can I display records "in inverted order", and still
> navigate
> > > > > > as usual (that means logicaly compared to the display) through
> > records
> > > ?

> > > > > > Valerie.

Other Threads