我有5列(type_id,Type,Quantity,NumberCalories,Category_id
),我需要根据更改“type
”检索“Category_id
”。请帮助我,他的是我的代码
const char *sql = "select type_id,Type,Quantity,NumberCalories from FoodType where Category_id=?";
答案 0 :(得分:0)
将 categoryId 传递给数据库方法并修改您的查询,如下所示
NSString *sqlQuery =[NSString stringWithFormat:@"select type_id,Type,Quantity,NumberCalories from FoodType where Category_id = %d",categoryId];
const char *sql= [sqlQuery UTF8String];