lundi 2 novembre 2015

FMResultset to Nsarray

I have 2035 object in my sqlite database. And I am trying to show them in tableview.I am adding objects to NSMutablearray with this code.

FMResultSet *rs = [database executeQuery:@"SELECT name,tel1 FROM KartDB"];
    KartList *kart = [[KartList alloc] init];
        while ([rs next]) {
            kart.name = [rs stringForColumn:@"name"];
            kart.tel1 = [rs stringForColumn:@"tel1"];

            [_customers addObject:kart];
        }

I put breakpoint to [_customers addObject:kart]; line. Its replacing all values every loop.What should I need for this.

Thanks.

Aucun commentaire:

Enregistrer un commentaire