select top :n * from 表名
where id =常量在给参数n赋值,我用的是ADOQuery1.parameters[0].value=edit1.text(或整形常量,字符型常量);编译时没有错误, 运行时,却说有语法错误,请问我该如何修改。
where id =常量在给参数n赋值,我用的是ADOQuery1.parameters[0].value=edit1.text(或整形常量,字符型常量);编译时没有错误, 运行时,却说有语法错误,请问我该如何修改。
调试欢乐多
where id =:常量
这里要改
然后那个下面的话,你最好作个转换吧ADOQuery1.parameters[0].value=strtoint(edit1.text)。这个针对数字的。
字符就不用转换了。
ADOQuery1.SQL.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select top ' + n + '* from 表名');
ADOQuery1.SQL.Add('where id =' + 常量 );
ADOQuery1.SQL.Open;
howyeahz2:
这个太麻烦了。
gytyl:
可以再说清楚点吗?
select top :n * from 表名
where id =:常量
要怎么该???
adoquery1.sql.clear;
adoquery1.sql.add('select top :n * from 表名 where id =:常量');
ADOQuery1.parameters[0].value=strtoint(edit1.text)。
adoquery1.open;
n:=常量;
ADOQuery1.SQL.Add('select top ' + inttostr(n) + '* from 表名');
ADOQuery1.SQL.Add('where id =' + 常量 );