D
ddzhouqian
Unregistered / Unconfirmed
GUEST, unregistred user!
见下面代码,table2插入失败时,table1仍然能够存取数据,不明啊?也没分了!探讨吧
procedure TMTSData.Supply_Insert(var vDDatas: OleVariant;
out vDMsg: WideString);
var i:Integer;
begin
vDMsg:='1';
if VarIsArray(vDDatas) then
begin
//取出插入数据
i:=VarArrayLowBound(vDDatas,1);
try
//插入table1
DSP.DataSet.Active:=True;
DSP.DataSet.Append;
DSP.DataSet.FieldByName('Corp_Code').AsString:=vDDatas;
DSP.DataSet.FieldByName('Supplier_Code').AsString:=vDDatas[i+1];
DSP.DataSet.FieldByName('Supplier_Name').AsString:=vDDatas[i+2];
DSP.DataSet.FieldByName('Supplier_Address').AsString:=vDDatas[i+3];
DSP.DataSet.FieldByName('Link_Man').AsString:=vDDatas[i+4];
DSP.DataSet.FieldByName('Station').AsString:=vDDatas[i+5];
DSP.DataSet.FieldByName('Tele').AsString:=vDDatas[i+6];
DSP.DataSet.FieldByName('Fax_Code').AsString:=vDDatas[i+7];
DSP.DataSet.FieldByName('E_Mail').AsString:=vDDatas[i+8];
DSP.DataSet.FieldByName('Http').AsString:=vDDatas[i+9];
DSP.DataSet.FieldByName('Supplier_Account').AsString:=vDDatas[i+10];
DSP.DataSet.FieldByName('Accout_Bank').AsString:=vDDatas[i+11];
DSP.DataSet.FieldByName('Accout_Name').AsString:=vDDatas[i+12];
DSP.DataSet.FieldByName('Remark').AsString:=vDDatas[i+13];
DSP.DataSet.Post;
//插入table2
DSPD.DataSet.Active:=True;
DSPD.DataSet.Append;
DSPD.DataSet.FieldByName('Corp_Code').AsString:=vDDatas;
DSPD.DataSet.FieldByName('Supplier_Code').AsString:=vDDatas[i+1];
DSPD.DataSet.FieldByName('id').AsString:='1';
DSPD.DataSet.Post;
SetComplete;
except
vDMsg:='0';
SetAbort;
end;
end;
end;
procedure TMTSData.Supply_Insert(var vDDatas: OleVariant;
out vDMsg: WideString);
var i:Integer;
begin
vDMsg:='1';
if VarIsArray(vDDatas) then
begin
//取出插入数据
i:=VarArrayLowBound(vDDatas,1);
try
//插入table1
DSP.DataSet.Active:=True;
DSP.DataSet.Append;
DSP.DataSet.FieldByName('Corp_Code').AsString:=vDDatas;
DSP.DataSet.FieldByName('Supplier_Code').AsString:=vDDatas[i+1];
DSP.DataSet.FieldByName('Supplier_Name').AsString:=vDDatas[i+2];
DSP.DataSet.FieldByName('Supplier_Address').AsString:=vDDatas[i+3];
DSP.DataSet.FieldByName('Link_Man').AsString:=vDDatas[i+4];
DSP.DataSet.FieldByName('Station').AsString:=vDDatas[i+5];
DSP.DataSet.FieldByName('Tele').AsString:=vDDatas[i+6];
DSP.DataSet.FieldByName('Fax_Code').AsString:=vDDatas[i+7];
DSP.DataSet.FieldByName('E_Mail').AsString:=vDDatas[i+8];
DSP.DataSet.FieldByName('Http').AsString:=vDDatas[i+9];
DSP.DataSet.FieldByName('Supplier_Account').AsString:=vDDatas[i+10];
DSP.DataSet.FieldByName('Accout_Bank').AsString:=vDDatas[i+11];
DSP.DataSet.FieldByName('Accout_Name').AsString:=vDDatas[i+12];
DSP.DataSet.FieldByName('Remark').AsString:=vDDatas[i+13];
DSP.DataSet.Post;
//插入table2
DSPD.DataSet.Active:=True;
DSPD.DataSet.Append;
DSPD.DataSet.FieldByName('Corp_Code').AsString:=vDDatas;
DSPD.DataSet.FieldByName('Supplier_Code').AsString:=vDDatas[i+1];
DSPD.DataSet.FieldByName('id').AsString:='1';
DSPD.DataSet.Post;
SetComplete;
except
vDMsg:='0';
SetAbort;
end;
end;
end;