我想從我的數據庫中的數據,但我沒有得到解決掉 我嘗試這樣迷糊中sqlite的select語句
- (空)信息
{
//[self createEditableCopyOfDatabaseIfNeeded];
NSString *filePath = [self getWritableDBPath];
sqlite3 *database;
if(sqlite3_open([filePath UTF8String], &database) == SQLITE_OK)
{
NSString *qu = @"Select Name FROM empl where SyncStatus ='1'";
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, [qu UTF8String], -1, &compiledStatement, NULL) == SQLITE_OK)
{
char *firstColumn = (char *)sqlite3_column_text(compiledStatement, 0);
if (firstColumn==nil)
{
NSString *name= [[NSString stringWithUTF8String:firstColumn]autorelease];
NSLog(@"%c",name);
}
if(sqlite3_step(compiledStatement) != SQLITE_ROW)
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"UIAlertView" message:@"User is not valid" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
alert = nil;
}
}
sqlite3_finalize(compiledStatement);
}
sqlite3_close(database);
}
得到它崩潰, 這讓我錯誤的原因: '* + [NSString的stringWithUTF8String:]:NULL CSTRING' 在第一擲 *調用堆棧:
謝謝它幫助我&amresh也說我一樣 – Harish