0

我的 sqlite 表结构是:

CREATE TABLE "location" ("latitude" DOUBLE,"longitude" DOUBLE,"date" DATETIME,"locationDescription" VARCHAR,"photopath" VARCHAR,"placemark" BLOB,"wheelId" INTEGER,"wheelSize" DOUBLE,"frontWheelx" DOUBLE,"frontWheely" DOUBLE,"rearWheelx" DOUBLE,"rearWheely" DOUBLE)

现在我想在表中插入一条记录,插入列:(日期,光路,wheelId,wheelSize,frontWheelx,frontWheely,rearWheelx,rearWheely)并忽略列:(纬度,经度,locationDescription,地标)

我的代码是:

    BOOL 成功 = [lunGaiDataBase executeUpdate:@"插入位置(日期、光路、wheelid、wheelsize、frontwheelx、frontwheely、rearwheelx、returnwheely)值(?,?,?,?,?,?,?,?)",
     location.date,location.photoPath, location.wheelId,location.wheelSize,location.frontWheelx,location.frontWheely,location.rearWheelx,location.rearWheely];


我的位置类是:

    @property (nonatomic, assign) 双纬度;
    @property (nonatomic, assign) 双经度;
    @property(非原子,保留)NSDate * 日期;
    @property (nonatomic, 保留) NSString * locationDescription;
    @property (nonatomic, 保留) NSString * photoPath;
    //@property (nonatomic, retain) NSString * category;
    @property(非原子,保留)CLPlacemark * 地标;
    @property (nonatomic, assign) NSInteger wheelId;
    @property(非原子,分配)双前轮;
    @property (nonatomic, assign) double frontWheely;
    @property(非原子,分配)双后轮;
    @property(非原子,分配)双后轮;
    @property(非原子,分配)双轮尺寸;

当我运行程序时,它崩溃了!帮我 !!

4

1 回答 1

0

如果我没记错的话,你的崩溃信息会是"EXC_BAD_EXCESS"对的吗?

尝试这个 :

BOOL succeed = [lunGaiDataBase executeUpdate:@"insert into location (wheelId) values(?)",
 [NSNumber numberWithInt:location.wheelId]];

由于wheelId被声明为NSInteger,您必须将其传递为

[NSNumber numberWithInt:location.wheelId]
于 2013-03-30T04:50:26.330 回答