Board index » delphi » Extracting values from a dbgrid row by row

Extracting values from a dbgrid row by row

Hi

I have a single column of values in a dbgrid which have been extracted
from a larger table using an sql query component. I was just wondering
if there is a way to take values row by row from the one column dbgrid
and if somebody could tell me how. Im using D5 Pro.

Scott

 

Re:Extracting values from a dbgrid row by row


You must use the query component which is attached to the dbgrid. You
must not use the dbgrid component. Here is the code:

procedure get_values;
var
value1:string;
begin
Query.first;
        while not query.eof do begin
                value1:=query.fields.fields[0].asstring;
                //process value1        
                query.next;
        end;
end;

Quote
Scott wrote:
> Hi

> I have a single column of values in a dbgrid which have been extracted
> from a larger table using an sql query component. I was just wondering
> if there is a way to take values row by row from the one column dbgrid
> and if somebody could tell me how. Im using D5 Pro.

> Scott

Re:Extracting values from a dbgrid row by row


I used it with the code I had and it worked!
Thanks!
Quote
Valrie Labonne <s...@caramail.comm> wrote in message <news:3D3EBA46.6030807@caramail.comm>...
> You must use the query component which is attached to the dbgrid. You
> must not use the dbgrid component. Here is the code:

> procedure get_values;
> var
> value1:string;
> begin
> Query.first;
>    while not query.eof do begin
>            value1:=query.fields.fields[0].asstring;
>            //process value1        
>            query.next;
>    end;
> end;

> Scott wrote:

> > Hi

> > I have a single column of values in a dbgrid which have been extracted
> > from a larger table using an sql query component. I was just wondering
> > if there is a way to take values row by row from the one column dbgrid
> > and if somebody could tell me how. Im using D5 Pro.

> > Scott

Other Threads