0
我正在使用此查詢來填充和創建我的table.But其不創建表和不插入值。使用FMDB for ios.I是noos在ios數據庫中,這是行不通的。請指導我如何使其工作。感謝提前。fmdb ios創建並插入查詢
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsPath = [paths objectAtIndex:0];
NSString *path = [docsPath stringByAppendingPathComponent:@"example.db"];
database = [FMDatabase databaseWithPath:path];
[database open];
[database executeUpdate:@"CREATE TABLE `report` (`id` int(100) NOT NULL AUTO_INCREMENT,`Date` double NOT NULL,`product` varchar(200) NOT NULL,`Description` varchar(200) NOT NULL,`price` varchar(200) NOT NULL,`address` varchar(200) NOT NULL,`payment` varchar(200) NOT NULL, PRIMARY KEY (`id`))"];
[database executeUpdate:@"insert into report(Date, product, Description, price, address,payment) values(?,?,?,?,?,?)",
1/1/05,abc,example,example123,example456,123,nil];
由於它食人魔它worked.Thanks真棒。 –