tags:

views:

16

answers:

1

i wnant to fetch the data fromt the database but getting error when i try to get the empty column... i used the following code to do it.. NSString *aDescription = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)]; so if my second column is empty than i get exception

A: 

Please put the condition to check the value:

NSString *aDescription = nil;
if((char *)sqlite3_column_text(compiledStatement, 2) != NULL)
{
      aDescription = [NSString stringWithUTF8String:(char*)sqlite3_column_text(compiledStatement, 2)];
}

Now the it will not generate the exception.

Jim
thank you for showing another approach
Jaimin