繁体   English   中英

如何在糖 orm findwithquery 方法中设置 int 参数以从 sqlite 数据库中检索数据

[英]How to set an int parameter in sugar orm findwithquery method to retreive data from sqlite database

伙计们,我想为 Sugar orm 中的 findwithquery 方法设置一个 int 参数,以从 android 中的 sqlite 数据库中检索数据。 这是查询

List<cart> c=cart.findWithQuery(cart.class,
"Select * from cart where customer=? and status=?",1,"NOTPAID")

*客户字段是数据库中的整数字段

当我执行上述操作时,我在“状态”附近出现语法错误

试试这个硬编码的客户字段 1

List<cart> c=cart.findWithQuery(cart.class,
"Select * from cart where customer=" + 1 + " and status=?", "NOTPAID");

对于动态客户字段

List<cart> c=cart.findWithQuery(cart.class,
"Select * from cart where customer=" + customerField + " and status=?", "NOTPAID");

暂无
暂无

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

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