我正在创建地址簿。它在sqlite中保存组名。但它不起作用。它不进入循环。?请检查我的代码。我的代码中有什么问题?
-(void) selectGroup
{
ssArray = [[NSMutableArray alloc]init];
NSString *selectStmt=[NSString stringWithFormat:@"select GroupName from AddGroup;"];
NSLog(@"the selet statement is :%@",selectStmt);
const char *cSelectStmt=[selectStmt UTF8String];
sqlite3_prepare_v2(database, cSelectStmt, -1, &statement, NULL);
while (sqlite3_step(statement)==SQLITE_ROW) {
const unsigned char *cName = sqlite3_column_text(statement, 0);
NSString *name=[NSString stringWithUTF8String:(const char *)cName];
[self.ssArray addObject:name];
}
sqlite3_finalize(statement);
NSLog(@"Array from database is :%@",ssArray);
}