//==============================================================================
//DataSet.将数据集转换为字符串**************************************************
//==============================================================================
function DataSetToStr(DataSet: TDataSet): WideString;
var SavePlace: TBookmark;
j: integer;
begin
if DataSet.IsEmpty then Exit;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Result := '';
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
with DataSet do
begin
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//字段名称******************************************************************
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
for j:=1 to Fields.Count do Result := Result + Fields[j-1].DisplayName + #9;
Result := Result + #13;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//数据内容******************************************************************
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SavePlace := GetBookmark;
DisableControls;
First;
while not Eof do
begin
for j:=1 to Fields.Count do Result := Result + Fields[j-1].AsString + #9;
Result := Result + #13;
Next;
end;
DataSetTryGotoMark(DataSet, SavePlace);
EnableControls;
end;
end;