0

我想将 ycount 字段添加到 1;

即ycount=ycount+1;

这是行不通的

[self Check_Create_DB];
sqlite3 *database; 
NSString *sqlTmp=[NSString stringWithFormat:@"update images set ycount=ycount+1 where imgid= '%d'",idimg ];
NSLog(@"%@",sqlTmp);
const char *sqlstmt=[sqlTmp UTF8String];
sqlite3_stmt *cmp_sqlstmt;
int returnvalue=sqlite3_prepare_v2(database,sqlstmt,-1,&cmp_sqlstmt,NULL);
NSLog(@"return value.....%d",returnvalue);
if(returnvalue == SQLITE_OK)
{           
    sqlite3_bind_int(cmp_sqlstmt,1,ycount+1);
}

这段代码有什么错误

4

1 回答 1

0

Try this way

NSString *sqlTmp=[NSString stringWithFormat:@"update images set ycount=%i where imgid= '%d'", ycount+1,idimg ];
于 2012-05-05T10:24:37.570 回答