gpt4 book ai didi

objective-c - 语法 : assign method's property value to sql command

转载 作者:行者123 更新时间:2023-11-29 11:19:58 26 4
gpt4 key购买 nike

我有方法:

-(NSMutableArray*)getTheCountriesEurope:(int)continentID
{
NSMutableArray* euCountriesArray=[[[NSMutableArray alloc]init]autorelease];
const char* sqlContinents="SELECT countries.countryID,countries.countryName\
FROM countries\
WHERE countries.relativeToContinentID=?";

如何将我的 (int)continentID 属性分配给 sql 命令?我的意思是声明

WHERE countries.relativeToContinentID=?";

提前谢谢你。

最佳答案

试试这个:

formattedString = [NSString stringWithFormat:
@"SELECT countries.countryID,countries.countryName\
FROM countries\
WHERE countries.relativeToContinentID=%i"
,continentID];

关于objective-c - 语法 : assign method's property value to sql command,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7753272/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com