求DELPHI强人帮我写个SQL语句好吗?

来源:百度知道 编辑:UC知道 时间:2024/07/16 09:28:49
这个语句快把我折磨死了,折磨写都不对
update timecard set'+dw(这是前面传过来的变量)+'='a'(这个是一个字符)',wid='+i+'kmonth='+j+'where un='+un+'and tn='+tn+'
这个是个固定格式,还是引号都可以用QuotedStr()代表?我如果查询是从前面控件传过来的变量呢?比如a是写'''+a+'''还是QuotedStr(a)

Const
SQLStr = 'UpDate idEmployees Set tName = %s,tSex = %s,tDepart = %s,tPro = %s where tCode = %s';
begin
_SQLText := ForMat(SQLStr,[QuotedStr(tName),QuotedStr(tSex),QuotedStr(tDepart),QuotedStr(tPro),QuotedStr(tCode)]);
FAccDataSvr.SetQuery(_SQLText);//执行语句
end;

照这个样子写,省得那么多引号看着眼花 QuotedStr 是引号

QuotedStr是字符串里的引号
'''+a+''' = QuotedStr(a)