Z
zpselect
Unregistered / Unconfirmed
GUEST, unregistred user!
我点击复制按钮,将当前选中的这笔记录复制起来,然后数据集APPEND,将复制的记录粘贴到新的记录中。
望改之;
procedure TMainForm.m_CopyClick(Sender: TObject);
var
strList: TStringList;
i: integer;
begin
inherited;
try
strList := TStringList.Create;
with DM do
begin
for i := 0 to E_Data.FieldCount - 1 do
if E_Data.Fields.FieldName <> 'RKEY' then
if E_Data.Fields.FieldKind = fkData then
strList.Add(E_data.Fields.AsString);
E_Data.Append;
for i := 0 to StrList.Count - 1 do
begin
if E_Data.Fields.FieldName <> 'RKEY' then
if E_Data.Fields.FieldKind = fkData then
E_Data.Fields.AsString := StrList;//这一句出错
end;
end;
finally
strList.Free;
end;
end;
望改之;
procedure TMainForm.m_CopyClick(Sender: TObject);
var
strList: TStringList;
i: integer;
begin
inherited;
try
strList := TStringList.Create;
with DM do
begin
for i := 0 to E_Data.FieldCount - 1 do
if E_Data.Fields.FieldName <> 'RKEY' then
if E_Data.Fields.FieldKind = fkData then
strList.Add(E_data.Fields.AsString);
E_Data.Append;
for i := 0 to StrList.Count - 1 do
begin
if E_Data.Fields.FieldName <> 'RKEY' then
if E_Data.Fields.FieldKind = fkData then
E_Data.Fields.AsString := StrList;//这一句出错
end;
end;
finally
strList.Free;
end;
end;