var
MSQLField:string;//SQL语句
MSQLTerm:string;//拼接语句
MErrorInfoStr:string;//错误语句
i :Integer;
begin
inherited;
MSQLField := '';
MSQLTerm := '';
MErrorInfoStr := '短信发送设置查询出错,请重新查询!!!';
//拼接SQL语句
MSQLField := MSQLField + 'select ssc.DeliStano, ssc.SDClno, ssc.CreateDateTime, ssc.CreateOperator,' + #13
+ 'ssc.Hour,s.Station as DeliStation, c.Chname as SDShipp from msSMSSendCondition ssc' + #13
+ 'left outer join bStat s on ssc.DeliStano = s.Stano' + #13
+ 'left outer join bCust c on ssc.SDClno = c.Clno ' + #13;
// 如果客户不为空
if RzButtonEditSearchSearchSDShipp.text <> '' then
begin
if MSQLTerm = '' then
begin
MSQLTerm := MSQLTerm + 'ssc.SDClno = ' + quotedstr(RzButtonEditSearchSearchSDShipp.RzEdit.Text) + #13;
end else begin
MSQLTerm := MSQLTerm + ' and ssc.SDClno = ' + quotedstr(RzButtonEditSearchSearchSDShipp.RzEdit.Text) + #13;
end;
end;
if RzButtonEditSearchStation.text <> '' then
begin
if MSQLTerm = '' then
begin
MSQLTerm := MSQLTerm + 'ssc.DeliStano = ' + quotedstr(RzButtonEditSearchStation.RzEdit.Text) + #13;
end else begin
MSQLTerm := MSQLTerm + ' and ssc.DeliStano = ' + quotedstr(RzButtonEditSearchStation.RzEdit.Text) + #13;
end;
end;
if MSQLTerm <> '' then
begin
MSQLTerm := 'where ' + MSQLTerm;
end;
[delphi] view plaincopy
SynchReadData(Handle, MSQLField + MSQLTerm, ClientDataSet, MErrorInfoStr);
SQL拼接
最新推荐文章于 2024-04-28 22:44:07 发布