sql问题delphi
varsqlwhere:string;sqlwhere:='(BillDateBETWEEN'+QuotedStr(edtStartDate.Text)+'AND'+Qu...
var sqlwhere: string; sqlwhere := '(BillDate BETWEEN ' + QuotedStr(edtStartDate.Text) + ' AND ' + QuotedStr(edtEndDate.Text) + ') '; //这边有括号括起来了 if chkAuditing.Checked then sqlwhere := sqlwhere + ' and verify=1 '//上面都括号起来了,为什么还可以再加字段?加在括号外面 else sqlwhere := sqlwhere + ' and verify<>1 '; sqlwhere := sqlwhere + ' and Number like ''%' + Trim(cxTE_Number.Text) + '%''';//这边也是?难道写在括号外面? QuerySQL := 'SELECT PrintQty from VPur_EditPriceForm where ' + sqlwhere; //还有这边,怎么接上去的呢???疑惑啊
展开
1个回答
展开全部
var sqlwhere: string; sqlwhere := '(BillDate BETWEEN ' + QuotedStr(edtStartDate.Text) + ' AND ' + QuotedStr(edtEndDate.Text) + ') '; //这边有括号括起,只是为了看起来比较器出一些,可以不用加的 if chkAuditing.Checked then sqlwhere := sqlwhere + ' and verify=1 '//上面都括号起来了,为什么还可以再加字段?加在括号外面,不影响语句的含义 else sqlwhere := sqlwhere + ' and verify<>1 '; sqlwhere := sqlwhere + ' and Number like ''%' + Trim(cxTE_Number.Text) + '%''';//这边也是?难道写在括号外面?同上 QuerySQL := 'SELECT PrintQty from VPur_EditPriceForm where ' + sqlwhere; //还有这边,怎么接上去的呢???这里是很简单的两个个字符串的连接
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询