简体   繁体   中英

Retrieve data from sqlite in iPhone

我有5列( type_id,Type,Quantity,NumberCalories,Category_id ),我需要根据更改“ Category_id ”检索“ type ”。请帮助我他是我的代码

const char *sql = "select type_id,Type,Quantity,NumberCalories from FoodType where Category_id=?";

Pass the categoryId to the database method and modify your query as below

NSString *sqlQuery =[NSString stringWithFormat:@"select type_id,Type,Quantity,NumberCalories from FoodType where Category_id = %d",categoryId];

const char *sql= [sqlQuery UTF8String]; 

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.

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