views:

22

answers:

1
while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
    // Read the data from the result row
    NSLog(@"WHILE IS OK");

    //// THIS NEXT STATEMENT ////
    NSString *araci = [[NSString alloc] stringWithUTF8String:(char *)
            sqlite3_column_text(compiledStatement, 1)];**

    [deneme addObject:araci];

    NSLog(@"Data read");
    NSLog(@"wow: %",araci);
}

It throws an exception like below:

[NSPlaceholderString stringWithUTF8String:]: unrecognized selector sent to instance 0x3d0c0c0'

what is the problem with the indicated statement? I used sqlitemanager. I have 3 attributes in my table relatively id(integer), name(text), desc(text). Also, I have one row for example. I cannot retrieve the name.

A: 

You're calling the stringWithUTF8String: method on NSString, which returns an autoreleased string - so you don't need to alloc call too. The line should read:

NSString *araci = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];

Also, incidentally, your NSLog call on the last line isn't quite right - the format specifier should be %@, rather than just %, because you're putting in an NSString:

NSLog(@"wow: %@",araci);
bio18
very thanks dude..
no prob! hope it worked out.
bio18