如何在TDbxReader实例中获取列的名称

时间:2010-10-10 07:40:10

标签: delphi delphi-2009

我想使用TDbxReader实例生成报告,但找不到获取aReader.value [index]列名称的方法。有人可以帮帮我吗?

  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; 

此致 赫

1 个答案:

答案 0 :(得分:2)

找到它。使用的是areader.dataType [index] .name