unit main;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComServ, ComObj, VCLCom, StdVcl, bdemts, DataBkr, DBClient,
MtsRdm, Mtx, hsjmts_TLB, DBXpress, FMTBcd, DB, SqlExpr, DBTables, ADODB,
activex;
type
Thsjtest = class(TMtsDataModule, Ihsjtest)
db: TADOConnection;
qry: TADOQuery;
qry1: TADOQuery;
procedure MtsDataModuleActivate(Sender: TObject);
procedure MtsDataModuleDeactivate(Sender: TObject);
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
functiondo
test(const data: WideString): WideString;
safecall;
public
{ Public declarations }
end;
var
hsjtest: Thsjtest;
implementation
{$R *.DFM}
class procedure Thsjtest.UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;
procedure Thsjtest.MtsDataModuleActivate(Sender: TObject);
begin
try
CoInitializeex(nil,COINIT_MULTITHREADED);
db.Connected:=true;
except
end;
end;
procedure Thsjtest.MtsDataModuleDeactivate(Sender: TObject);
begin
qry.close;
//qry1.close;
db.Connected:=false;
end;
function Thsjtest.dotest(const data: WideString): WideString;
var i:integer;
lsh_zb,lsh_mx:string;
begin
// TD.TransactionID := 1;
//TD.IsolationLevel := xilREADCOMMITTED;
i:=pos(',',data);
lsh_zb:=copy(data,1,i-1);
lsh_mx:=copy(data,i+1,length(data));
try
qry.close;
qry.SQL.Clear;
qry.SQL.Text:='select * from sbls ';
qry.Open;
qry.close;
qry.SQL.clear;
qry.SQL.Text:='insert sbls(lsh,swdm,sblx) '+
'select '+lsh_zb+',''aaaaa'',''1''';
qry.ExecSQL();
qry1.close;
qry1.SQL.Clear;
qry1.SQL.Text:='select * from sbls ';
qry1.Open;
qry.close;
qry.SQL.clear;
qry.SQL.Text:='insert smls(lsh,xh,xmdm,je) '+
'select '+lsh_mx+',1,''001'',1';
qry.ExecSQL();
self.SetComplete;
result:='ok';
except
on e:exceptiondo
begin
result:=e.Message;
self.SetAbort;
end;
end;
end;
initialization
CoInitialize(nil);
TComponentFactory.Create(ComServer, Thsjtest,
Class_hsjtest, ciMultiInstance, tmApartment);
finalization
CoUninitialize();
end.