私はFMDBを使用しています。次のコードを実行しましたFMDBにプライマリIDがありません
FMResultSet *results = [database executeQuery:@"select * from customer"];
while([results next])
{
Customer *customer = [[Customer alloc] init];
customer.customerId = [results intForColumn:@"id"];
customer.firstName = [results stringForColumn:@"firstname"];
customer.lastName = [results stringForColumn:@"lastname"];
[customers addObject:customer];
NSLog(@"%d", customer.customerId);
}
しかし、私はcustomerId値を取得していません。私はちょうど自動的にインクリメントされるROWIDをしたい。
親切...何かを示唆して
「お客様」テーブルの構造は何ですか? – Ilanchezhian
テーブルに名前が 'id'のフィールドはありますか? – Ilanchezhian
いいえ。idのフィールドはありません。それはfirstnameとlastnameだけを持っています。しかし、自動的に作成され、自動的にインクリメントされるROWIDが必要です。 – Myaaoonn