JackQu的程序员博客

欢迎来的我Blog.这里记录工作学习的点滴,愿与大家分享。欢迎大家共同交流 。

导航

简单的函数


Function UpdateOrInsert(Fbentityid,Itemid,CNTRID:integer):boolean;
  
var aSQLQuery: TSQLQuery;
begin
    Result:
=True;
    aSQLQuery:
=TSqlquery.create(nil);
    
with aSQLQuery do try
      Close;SQL.Clear;
      SQLConnection:
=SQLConn;
      sql.Add(
'select count(*) from PRICEMNGITEMS ');
      sql.Add(
'where Sysid=:Sysid  and Entityid=:Entityid and itemid=:itemid and CNTRID=:CNTRID');
      ParamByName(
'Sysid').asInteger:=FSysid;
      ParamByName(
'Entityid').asInteger:=FBEntityID;
      ParamByName(
'Itemid').asInteger:=Itemid;
      ParamByName(
'CNTRID').asInteger:=CNTRID;
      Open;
        
if (not IsEmpty) and (FieldByName('Count').AsInteger>0then
        
begin
         Result:
=False;
         exit;
      
end;
    
finally
      free;
    
end;
end

posted on 2008-12-19 15:40  Qcj  阅读(242)  评论(0编辑  收藏  举报