tmpDC := DECIMALSEPARATOR;
DECIMALSEPARATOR := ‘.’; // Числа в англицком формате
if iRowCount > 1 then
RecordSet.MoveFirst;
for j := 0 to iRowCount - 1 do
begin // пишем данные
write(F_sv, ‘ ‘);
for i := 0 to iColCount - 1 do
begin
case Fields[i].FieldType of
‘D’: if not VarIsNull(RecordSet.Fields[i].Value) then
L := FormatDateTime(’yyyymmdd’,
VarToDateTime(RecordSet.Fields[i].Value))
else
L := ‘1900101′;
‘N’, ‘F’: if not VarIsNull(RecordSet.Fields[i].Value) then
L := Format(’%’ + IntToStr(Fields[i].FieldSize -
Fields[i].FieldDigits) + ‘.’ + IntToStr(Fields[i].FieldDigits) +
‘f’, [StrToFloatDef(VarToStr(RecordSet.Fields[i].Value), 0)])
else
L := ”;
else if not VarIsNull(RecordSet.Fields[i].Value) then
L := Ansi2Oem(VarToStr(RecordSet.Fields[i].Value))
else
L := ”;
end;
while Length(L) < Fields[i].FieldSize do
if Fields[i].FieldType in ['N', 'F'] then
L := L + #0
else
L := L + ' ';
if Length(L) > Fields[i].FieldSize then
SetLength(L, Fields[i].FieldSize);
write(F_sv, l);
end;
RecordSet.MoveNext;
end;
DECIMALSEPARATOR := tmpDC;
write(F_sv, Chr($1A));
CloseFile(F_sv);
except
Result := False;
if FileExists(FileName) then
DeleteFile(FileName);
end;
end;
function CopyRecordSet(RecordSet: _RecordSet): _RecordSet;
var
adoStream: OleVariant;
begin
adoStream := CreateOLEObject(’ADODB.Stream’);
Variant(RecordSet).Save(adoStream, adPersistADTG);
Result := CreateOLEObject(’ADODB.RecordSet’) as _RecordSet;
Result.CursorLocation := adUseClient;
Result.Open(adoStream, EmptyParam, adOpenStatic, adLockOptimistic,
adOptionUnspecified);
adoStream := UnAssigned;
end;
function UniqueTableName: string;
var
G: TGUID;
begin
CreateGUID(G);
Result := GUIDToString(G);
Delete(Result, 1, 1);
Delete(Result, Length(Result), 1);
while Pos(’-', Result) > 0 do
Delete(Result, Pos(’-', Result), 1);
Result := ‘T’ + Result;
end;
end.
Эта запись была опубликована 14.12.2007в 20:58. В рубриках: ADO, Базы данных. Вы можете следить за ответами к этой записи через RSS 2.0. Комментарии пока закрыты, но Вы можете оставить трекбек со своего сайта.