tags:

views:

12

answers:

0

why i can access only last element from list

this is my data i am pulling from sql

if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
  NSLog(@"TEST1");
  // Loop through the results and add them to the feeds array
  while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
    // Read the data from the result row

    NSLog(@"TEST2");

    Book * aBook = [[Book alloc] init];
    aBook.id = [NSString stringWithUTF8Stringchar *)sqlite3_column_text(compiledStatement, 0)];

///////// now in rootview
- (UITableViewCell *)tableViewUITableView *)tableView cellForRowAtIndexPathNSIndexPath *)indexPath {
  static NSString *CellIdentifier = @"Cell";

  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
  }

  // Set up the cell
  SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
  //Animal *animal = (Animal *)[appDelegate.animals objectAtIndex:indexPath.row];

  //Book *aBook = (Book *)[appDelegate.books objectAtIndex:indexPath.row];
  Book *aBooks = [appDelegate.books objectAtIndex:indexPath.row];

  cell.text = aBooks.id;

  //[cell setText:aBook.name];
  NSLog(@"name is %@",aBooks.id);

book.id alwyas show me the last value but u want to display all 10 values