– (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
NSString* dbName=[Internationalization getKwp2000DBName];//@”FaultCode.sqlite”;
_dbPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:dbName];
FMDatabase *db=[FMDatabase databaseWithPath:_dbPath];
[faultMutabelArray removeAllObjects];
if ([db open]) {
NSString *NSsql=[NSString stringWithFormat:@”SELECT Title FROM t_person WHERE name like “”%%%@%%”” ;”,searchText,nil];
FMResultSet *resultSet = [db executeQuery:NSsql];
while ([resultSet next]) {
NSString * number = [resultSet stringForColumn:@”Title”];
NSString *FaultStringNumber = [number substringToIndex:5];
if (FaultStringNumber!= nil) {
[faultMutabelArray addObject:FaultStringNumber];
}
}
}else
{
NSLog(@”数据库打开失败”);
}
}
为什么没有满足[resultset next],不执行while里边的东西