读书人

这个SQL 语句为什么不对? ()

发布时间: 2012-03-03 15:33:04 作者: rapoo

这个SQL 语句为什么不对?? (在线等)
str= "update quotittable set stepvalue= "+FloatToStr(_coefit2)+ "where freqytype= ' "+type+ " 'and step= "+IntToStr(a)+ "and chanleno= "+no;
fmanage.UpdateFileinfor(str);

freqytype 为文本型 其他都为 数字型

[解决办法]
str= "update quotittable set stepvalue= "+FloatToStr(_coefit2)+ " where freqytype= ' "+type+ " 'and step= "+IntToStr(a)+ " and chanleno= "+no;
fmanage.UpdateFileinfor(str);

注意空格

可以输出str出来看看
[解决办法]
sql语法错误编译看不出错误,按照楼上说的将str输出看看那里出错了,再修改。
[解决办法]
1、where前面需要加一个空格
2、stepvalue字段是否是字符串的,需要在值两边加单引号,转义字符\开路
str= "update quotittable set stepvalue=\ ' "+FloatToStr(_coefit2)+ "\ ' where
[解决办法]
str= "update quotittable set stepvalue= "+FloatToStr(_coefit2)+ " where freqytype= ' "+type+ " 'and step= "+IntToStr(a)+ " and chanleno= "+no;


ShowMessage(str);(或者输出到文件中)


fmanage.UpdateFileinfor(str);

读书人网 >C++ Builder

热点推荐