用户名:  密码:   
您当前的位置:首页 > 程序设计 >  Delphi > 

Delphi合并连接有单引号的SQL语句字串

上次修改时间: 2023-05-06 09:39:24      来源:网络总结      作者:钢铁长陈
上一页      路径:DSD\Learn\Delphi语言\常用控件之数据库控件与操作相关\      下一页

Delphi合并连接有单引号的SQL语句字串.txt

主要解决变量在SQL语句中是用单引号引起来的,
例:wherestr:='where salesday between '''+sdate+''' and '''+edate+''' '要生成:where between '2023-03-31' and '2023-05-03'

原则:变量在字串中间时左右侧都是3个单引号,变量在字串最后时侧边三引号右则四引号
例:wherestr:='where salesday between '''+sdate+''' and '''+edate+''' ';
 //变量sdata中字串中间,左右侧都是三个引号
 //变量edata在字串最后,在侧3个引号,右则四个引号
 //最终生成的示例:where between '2023-03-31' and '2023-05-03'