Guys I want to set an int parameter to the findwithquery method in sugar orm to retrieve data from sqlite database in android. This is the query
List<cart> c=cart.findWithQuery(cart.class,
"Select * from cart where customer=? and status=?",1,"NOTPAID")
*the customer field is a integer field in the database
When I execute the above I get syntax error near "status"
Try this for hardcoded customer field 1
List<cart> c=cart.findWithQuery(cart.class,
"Select * from cart where customer=" + 1 + " and status=?", "NOTPAID");
For dynamic customer field
List<cart> c=cart.findWithQuery(cart.class,
"Select * from cart where customer=" + customerField + " and status=?", "NOTPAID");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.