首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

sql语句异常

2012-03-02 
sql语句错误定义变量s,sql为string类型,s为函数参数,sql:select field1 from table1 where+s运行时s赋

sql语句错误
定义变量s,sql为string类型,s为函数参数,sql:='select field1 from table1 where'+s;运行时s赋值为id>7或者id<7、id=7,但是运行时总是出错,请各位帮我改错,多谢!


[解决办法]
showMessage(sql)下看看

sql:='select field1 from table1 where '+s;
有可能where后边要加个空格
[解决办法]
sql:='select field1 from table1 where'+s
这样写不太好吧
改成这样试一试:
sql:='select field1 from table1';
if (条件) then
sql:=sql+'where id>7';
if (条件) then
sql:=sql+'where id<7';
if (条件) then
sql:=sql+'where id=7';

新手回答问题,见笑了!

热点排行