开发者

How to check if database is returning NULL

I am using sqlite database with my app

following is my code which is getting data

        while(sqlite3_step(compiledStatement) == SQLITE_ROW)
        {


            NSString *str1 = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)];

            [dataArray addObject:str1];



        }   

this program crashed if there is null in database.

Actually i have multiple columns and i am saving data only to one column of a row so other remain null, this creating problem...

can anyone tell me how to 开发者_运维技巧check if current value is null

i have tried to check if str1 is null here?

but prog crashes ....

thank you please help


Code as follows,

if(sqlite3_column_text(statement, 0) != nil)
{
//Data exists
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜