views:

17

answers:

1

I want to make a report with a TDbxReader instance but don't find the way to get the name of aReader.value[index] column. Somebody could help me?

  aCmnd.Text := 'SELECT * FROM Country'; 
  aCmnd.Prepare; 
  aReader := aCmnd.ExecuteQuery; 

  aColCount := aReader.ColumnCount; 
  Writeln( 'Results from Query: ' + aCmnd.Text ); 

  // write column headers, but don´t know column names
  for iColumn:= 0 to aColCount -1 do 
    Write(aReader.Value[iColumn].name + '  '); //would like unexistent name property
                                               //How can I do something like this?     
  writeln;
  while aReader.Next do 
  begin 
    for iColumn:= 0 to aColCount -1 do  
      Writeln( aReader.Value[iColumn].GetAnsiString + '  '); //assume string fields
  end; 

Regards, Hector

+1  A: 

Found it. Used areader.dataType[index].name

Hector Rios