0
我有一個提醒Use of undeclared identifier 'sql3'
。使用未聲明的標識符 - 標識符位於「if語句」中
如果我刪除if statement
,沒有問題,但看起來在if statement
內部時不會被識別。
有沒有辦法解決它?
if ([typedepartie isEqual: @"ami"]) {
const char *sql3 =
[[NSString stringWithFormat:@"SELECT id
FROM tabledesquestions
WHERE pack = ? ORDER BY RANDOM() LIMIT 4"]
cStringUsingEncoding:NSUTF8StringEncoding];
}
listequestionmulti = [[NSMutableArray alloc]init];
sqlite3_stmt *sql1Statement;
if(sqlite3_prepare(database1, sql3, -1, &sql1Statement, NULL) != SQLITE_OK) {
NSLog(@"Problem with prepare statement: %s", sqlite3_errmsg(database1));
}
TY無光,有啥保持SQL3有效的大括號後的好辦法嗎? – user3277279
在花括號之外(即之前)定義它。 – matt
大括號裏會發生什麼,留在大括號裏! :))))) – matt