Delphi- How do I take information from my dbgrid and put it into my variables?
(2011-08-02 14:15:13) 1. Says: I know how to display the information in my database but have no clue on how to take that info and use it in my array2. Says: Hi there,Try something like the following listing. Obviously, you will need to substitute names where needed, so that the code will work for you, in your specific case.
However, if you need assistance, or you need the code in a demo project, please feel free to mail me at mystic.smeg@yahoo.co.uk, and I'll be glad to help.
na
---- listing ----
var var_array: array[1..100] of variant; //some static array of variant
{... code ...}
var i: integer;
begin
//start of array
i:=Low(var_array);
//first record
ADOQuery1.First;
//loop records
while (i<High(var_array)) and (not ADOQuery1.EOF) do
begin
//copy data from database table, field SomeFieldName into var_array[n]
var_array := ADOQuery1.FieldByName ('SomeFieldName').Value;
//next record, array element
ADOQuery1.Next;
Inc(i);
end; //while
{... code ...}
end; Tag: Delphi- How do I take information from my dbgrid and put it into my variables?
