M
malaya
Unregistered / Unconfirmed
GUEST, unregistred user!
一个web Service的DLL:(获取信息)
function TTest.getInfo(nsrsbh,fname:string):widestring;
var
sqlstr,nsrInfo,connstr:string;
adoqueryAuto : TAdoQuery;
adoconn:TADOConnection;
begin
connstr:='Provider=SQLOLEDB.1;Password=dzbs;Persist Security Info=True;Data Source=77.60.44.32;User ID=jtax;Initial Catalog=jtax';
adoconn:=TADOConnection.Create(nil);
adoqueryAuto := TAdoQuery.Create(nil);
adoconn.ConnectionString:=connstr;
adoconn.Connected:=true;
adoqueryAuto.Connection:=adoconn;
sqlstr:='select * from userbaseinfo where nsrsbh='''+nsrsbh+''' ';
with adoqueryAutodo
begin
close;
sql.Clear;
sql.Add(sqlstr);
open;
nsrInfo:=fieldbyname(fname).AsString ;
end;
result:=nsrInfo;
end;
这样一个文件,其中客户端每次调用都会产生一个adoconn,有没什么办法只连接一次
function TTest.getInfo(nsrsbh,fname:string):widestring;
var
sqlstr,nsrInfo,connstr:string;
adoqueryAuto : TAdoQuery;
adoconn:TADOConnection;
begin
connstr:='Provider=SQLOLEDB.1;Password=dzbs;Persist Security Info=True;Data Source=77.60.44.32;User ID=jtax;Initial Catalog=jtax';
adoconn:=TADOConnection.Create(nil);
adoqueryAuto := TAdoQuery.Create(nil);
adoconn.ConnectionString:=connstr;
adoconn.Connected:=true;
adoqueryAuto.Connection:=adoconn;
sqlstr:='select * from userbaseinfo where nsrsbh='''+nsrsbh+''' ';
with adoqueryAutodo
begin
close;
sql.Clear;
sql.Add(sqlstr);
open;
nsrInfo:=fieldbyname(fname).AsString ;
end;
result:=nsrInfo;
end;
这样一个文件,其中客户端每次调用都会产生一个adoconn,有没什么办法只连接一次