Board index » delphi » Getting the current record displayed in a DBGrid?

Getting the current record displayed in a DBGrid?

Hi folks!

I'm writing an app that performs a query on data stored in a SQLServer
table.  The query portion of my app works fine, the records I need to
display are shown in my DBGrid.  Now I want to be able to retrieve values
from a particular record I've clicked on in the DBGrid?  Any suggestions
about how I get this?  Thanks!

Bill Valaski
Section Manager - Computer Operations

CDS Associates, Inc.
Cincinnati, OH  USA
513.791.1700
www.cds-assoc.com

 

Re:Getting the current record displayed in a DBGrid?


Quote
"Bill Valaski" <BVala...@cds-assoc.com> wrote in message

news:3e9c65af$1@newsgroups.borland.com...

Quote
> Hi folks!

> I'm writing an app that performs a query on data stored in a SQLServer
> table.  The query portion of my app works fine, the records I need to
> display are shown in my DBGrid.  Now I want to be able to retrieve values
> from a particular record I've clicked on in the DBGrid?  Any suggestions
> about how I get this?  Thanks!

Hi,

Do you just want vaules from the current 'grid record' ??
In that case :

YourGrid.DataSource.DataSet.FieldByName('aFieldName').AsXXXX

hth,
Leo

Re:Getting the current record displayed in a DBGrid?


Quote
>Now I want to be able to retrieve values
>from a particular record I've clicked on in the DBGrid?  Any suggestions
>about how I get this?

Do you mean retrieve the current values of a record where what you are looking
at may be out of date?

Adodataset1.RecordSet.Resync(adAffectCurrent, adResyncAllValues);
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Getting the current record displayed in a DBGrid?


Leif,

That worked just like I wanted.  Thanks so much!

Bill

Quote
>>> Leif Eirik Olsen<le...@-nospam-wmdata.no> Apr 15, 2003 4:36:00 PM >>>
"Bill Valaski" <BVala...@cds-assoc.com> wrote in message

news:3e9c65af$1@newsgroups.borland.com...

Quote
> Hi folks!

> I'm writing an app that performs a query on data stored in a SQLServer
> table.  The query portion of my app works fine, the records I need to
> display are shown in my DBGrid.  Now I want to be able to retrieve values
> from a particular record I've clicked on in the DBGrid?  Any suggestions
> about how I get this?  Thanks!

Hi,

Do you just want vaules from the current 'grid record' ??
In that case :

YourGrid.DataSource.DataSet.FieldByName('aFieldName').AsXXXX

hth,
Leo

Other Threads