android 中的sqlite语句怎么使用占位符
1个回答
展开全部
withValue1:(NSString*) value1
withValue2:(NSString*) value2
withValue3:(NSString*) value3
{
NSString * sql = [NSStringstringWithFormat:@"insert into members('name','email','birthday') values (?,?,?)"];
sqlite3_stmt *statement;
if(sqlite3_prepare_v2(db, [sqlUTF8String], -1, &statement,nil) ==SQLITE_OK){
sqlite3_bind_text(statement,1, [value1 UTF8String], -1,NULL);
sqlite3_bind_text(statement,2, [value2 UTF8String], -1,NULL);
sqlite3_bind_text(statement,3, [value3 UTF8String], -1,NULL);
}
if (sqlite3_step(statement) !=SQLITE_DONE) {
withValue2:(NSString*) value2
withValue3:(NSString*) value3
{
NSString * sql = [NSStringstringWithFormat:@"insert into members('name','email','birthday') values (?,?,?)"];
sqlite3_stmt *statement;
if(sqlite3_prepare_v2(db, [sqlUTF8String], -1, &statement,nil) ==SQLITE_OK){
sqlite3_bind_text(statement,1, [value1 UTF8String], -1,NULL);
sqlite3_bind_text(statement,2, [value2 UTF8String], -1,NULL);
sqlite3_bind_text(statement,3, [value3 UTF8String], -1,NULL);
}
if (sqlite3_step(statement) !=SQLITE_DONE) {
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询