delphi sqlsever 实现存在则更新,不存在

(' if exists(select * from NBcommission where Type='''+sType+'''and ItemNo='''+s+''' ) '+
' begin'+
' update NBcommission set Amount='''+m+''' , CType='''+sCType+'''where Type='''+sType+'''and ItemNo='''+s+''' ;'+
' end;' +
' else'+
' begin'+
' INSERT into NBcommission (Type,ItemNo,Unit,Amount,Ctype) values ( '''+sType+''' , '''+s+''' , ''' +sUnit+ ''' , ''' +m+ ''' , ''' +sCType+ '''); '+
' end;'
);

posted @ 2017-09-20 10:49  快乐的正能量  阅读(246)  评论(0编辑  收藏  举报