delphi能不能像SQL那样动态拼语句
展开全部
i := Pos('[', sCondition);
j := Pos(']', sCondition);
if s <> '' then
if (QryTemp.FieldByName('flag').AsInteger = 1) then
s := s + ' and '
else
s := s + ' or ';
s := s + Copy(sCondition, i+1, j-i-1)
sCondition := Copy(sCondition,j+1, Length(sCondition)-j);
until Pos('[') = 0;
j := Pos(']', sCondition);
if s <> '' then
if (QryTemp.FieldByName('flag').AsInteger = 1) then
s := s + ' and '
else
s := s + ' or ';
s := s + Copy(sCondition, i+1, j-i-1)
sCondition := Copy(sCondition,j+1, Length(sCondition)-j);
until Pos('[') = 0;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询