0

我有 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=?";
4

1 回答 1

0

categoryId传递给数据库方法并修改您的查询,如下所示

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

const char *sql= [sqlQuery UTF8String]; 
于 2012-08-03T21:04:29.050 回答