cccicl
cccicl
发布于 1个月前

DB Error: 1 "no such table: ;syntax error in "INSERT INTO

Huxmen*humodel =[[Huxmenalloc]init];

humodel.name=[NSStringstringWithFormat:@"%@",_nameTfield.text];

humodel.tele=[NSStringstringWithFormat:@"%@",_numTfield.text];

humodel.simi=@"0";

humodel.formatTime =[faTool currentFormatTime];

humodel.addTime=[faTool currentTimeTimestamp];

NSLog(@"333333-----%@",humodel.addTime);

[[JQFMDB shareDatabase] jq_insertTable:@"father" dicOrModel:humodel];

用的JQFMDB 插入数据无效,报错syntax error in "INSERT INTO father ) values ()" syntax error" DB Query: INSERT INTO father ) values ()

解决方案:

插入之前没有判断

JQFMDB *db = [JQFMDB shareDatabase];

if (![db jq_isExistTable:@"father"]) {

[db jq_createTable:@"father" dicOrModel:[Huxmen class]];

}else{

Huxmen*humodel =[[Huxmenalloc]init];

humodel.name=[NSStringstringWithFormat:@"%@",_nameTfield.text];

humodel.tele=[NSStringstringWithFormat:@"%@",_numTfield.text];

humodel.simi=@"0";

humodel.formatTime =[faTool currentFormatTime];

humodel.addTime=[faTool currentTimeTimestamp];

NSLog(@"333333-----%@",humodel.addTime);

[[JQFMDB shareDatabase] jq_insertTable:@"father" dicOrModel:humodel];

}

DB

相关文章

©2020 edoou.com   京ICP备16001874号-3