1,178
社区成员
发帖
与我相关
我的任务
分享
function TCustomADODataSet.GetFieldData(Field: TField; Buffer: Pointer;
NativeFormat: Boolean): Boolean;
var
RecBuf: PChar;
Data: OleVariant;
procedure CurrToBuffer(const C: Currency);
begin
if NativeFormat then
DataConvert(Field, @C, Buffer, True) else
Currency(Buffer^) := C;
end;
procedure VarToBuffer;
begin
with tagVariant(Data) do
case Field.DataType of
ftGuid, ftFixedChar, ftString:
begin
PChar(Buffer)[Field.Size] := #0;
WideCharToMultiByte(0, 0, bStrVal, SysStringLen(bStrVal)+1,
Buffer, Field.Size, nil, nil);
end;
ftWideString:
WideString(Buffer^) := bStrVal;
ftSmallint:
if vt = VT_UI1 then
SmallInt(Buffer^) := Byte(cVal) else
SmallInt(Buffer^) := iVal;
ftWord:
if vt = VT_UI1 then
Word(Buffer^) := bVal else
Word(Buffer^) := uiVal;