各位请指教,并提出指正:
客户端(插入代码):
procedure TForm1.Button4Click(Sender: TObject);
var qCoor:IMTSDemoQueryCoor;
vDatas: array of string;
begin
qCoor:=CoMTSDemoQueryCoor.CreateRemote('127.0.0.1');
SetLength(vDatas,2);
vDatas[0]:=Edit1.Text;
vDatas[1]:=Edit2.Text;
qCoor.InsertPublishers(vDatas[0],vDatas[1]);
end;
业务层(更新代码):
procedure TMTSDemoQueryCoor.InsertPublishers(const vDatas1,
vDatas2: WideString);
var Publishers : IMTSPublishers;
begin
//InsertPublishers
if not assigned(Publishers) then
Publishers := CoMTSPublishers.Create;
Publishers.InsertPublishers(vDatas1,vDatas2);
end;
数据处理层(更新代码):
procedure TMTSPublishers.InsertPublishers(const vData1,
vData2: WideString);
begin
try
ADOCPublishers.begin
Trans;
ADOQUpdate.Close;
ADOQUpdate.SQL.Clear;
ADOQUpdate.SQL.Add('Insert into Publishers (VID,PublisherName) values
VID,
ublisherName)');
ADOQUpdate.Parameters.ParamByName('VID').Value:=vData1;
ADOQUpdate.Parameters.ParamByName('PublisherName').Value:=vData2;
ADOQUpdate.ExecSQL;
ADOQUpdate.Close;
ADOQUpdate.SQL.Clear;
ADOQUpdate.SQL.Add('Insert into Books (VID,BookID,BookName) values
VID,:BookID,:BookName)');
ADOQUpdate.Parameters.ParamByName('VID').Value:='';
ADOQUpdate.Parameters.ParamByName('BookID').Value:='';
ADOQUpdate.Parameters.ParamByName('BookName').Value:='测试';
ADOQUpdate.ExecSQL;
ADOCPublishers.CommitTrans;
//SetComplete;
except
ADOCPublishers.RollbackTrans;
//SetAbort;
end;
end;
谢谢了