繁体   English   中英

SQL限制子句-vb.net

[英]SQL Limit clause - vb.net

我一直在寻找有关LIMIT子句的查询解决方案,这是我的代码,

    "SELECT * FROM tbl_student WHERE s_grade='" & grade.Text & "' AND s_status='Validated' ORDER BY s_id_no ASC LIMIT 10"

我想知道是否可以做

    "SELECT * FROM tbl_student WHERE s_grade='" & grade.Text & "' AND s_status='Validated' ORDER BY s_id_no ASC LIMIT='" & txt_limit.Text & "'"

根据我的选择(包含极限)获得极限值,但未能这样做,我得到此语法错误。

=不能与LIMIT一起使用
尝试这个

 "SELECT * FROM tbl_student WHERE s_grade='" & grade.Text & "' AND
 s_status='Validated' ORDER BY s_id_no ASC LIMIT " & txt_limit.Text & ";

LIMIT='" & txt_limit.Text & "'更改为LIMIT " & txt_limit.Text & "

两次更正
1.) LIMIT==对LIMIT子句无效
2.) '" & txt_limit.Text & "' :您将其串联为字符串,因为
您已使用''命令文本产生LIMIT '10' ,因此应避免使用''

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM