L
likongxu
Unregistered / Unconfirmed
GUEST, unregistred user!
函数原型:
function NewTQuery:TQuery;
函数实现:(其中dmFk为DataModule名字,dbFk为数据模块上的TDataBase控件名.)
function NewTQuery:TQuery;
begin
Result:=TQuery.Create(Application);
Result.DatabaseName:=dmFk.dbFk.DatabaseName;
Result.RequestLive:=False;
Result.Close;
end;
使用方法:
function HasExistTheTimeFlagData(const strTermAddr,strAm,strTimeFlag:string):Boolean;
var
strSql:string;
tmpQuery:TQuery;
begin
Result:=False;
tmpQuery:=NewTQuery();
try
strSql:='select terminaladdr from real ';
strSql:=strSql+' where terminaladdr = '+QuotedStr(strTermAddr);
strSql:=strSql+' and ammeterno = '+QuotedStr(strAm);
strSql:=strSql+' and timeflag = '+QuotedStr(strTimeFlag);
if ActiveMyAdoSql(tmpQuery,strSql) then
// 此函数用自己的代码替换;
Result:=tmpQuery.FieldByName('terminaladdr').AsString <> '';
finally
tmpQuery.Free;
end;
end;
function NewTQuery:TQuery;
函数实现:(其中dmFk为DataModule名字,dbFk为数据模块上的TDataBase控件名.)
function NewTQuery:TQuery;
begin
Result:=TQuery.Create(Application);
Result.DatabaseName:=dmFk.dbFk.DatabaseName;
Result.RequestLive:=False;
Result.Close;
end;
使用方法:
function HasExistTheTimeFlagData(const strTermAddr,strAm,strTimeFlag:string):Boolean;
var
strSql:string;
tmpQuery:TQuery;
begin
Result:=False;
tmpQuery:=NewTQuery();
try
strSql:='select terminaladdr from real ';
strSql:=strSql+' where terminaladdr = '+QuotedStr(strTermAddr);
strSql:=strSql+' and ammeterno = '+QuotedStr(strAm);
strSql:=strSql+' and timeflag = '+QuotedStr(strTimeFlag);
if ActiveMyAdoSql(tmpQuery,strSql) then
// 此函数用自己的代码替换;
Result:=tmpQuery.FieldByName('terminaladdr').AsString <> '';
finally
tmpQuery.Free;
end;
end;