首页 > 代码库 > IOS SQLIte 数据库操作

IOS SQLIte 数据库操作

NSString* docsDir = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory,NSUserDomainMask,YES) lastObject];

NSString* dbPath = [docsDir stringByAppendingPathComponent:@"people.db"];

FMDatebase* db = [FMDatebase databaseWithPath:dbPath];

FMResultSet* rs = [db executeQuery:@"select * from people"];

if(![db open])

{

return;

}

while ([rs next])

{

[rs stringForColumn:@"firstname"];

[rs stringForColumn:@"lastname"]

}

[db close];


IOS SQLIte 数据库操作