我正在使用FMDB。我執行以下代碼在FMDB中找不到主要標識
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 2012-02-06 09:07:46
你的表中是否有名稱爲「id」的字段? – Ilanchezhian 2012-02-06 09:09:48
不..沒有id的字段。它只有名字和姓氏。但我想要自動創建並自動遞增的rowid。 – Myaaoonn 2012-02-06 09:19:39