sqlite3_stmt *stmt; int x; char *update = "insert into PersonnamesAndBirthDates (names,Birthdates,Phonenumber,Email,Profilepic) values(?,?,?);"; x = sqlite3_prepare_v2(database1,update,-1,&stmt,nil); if (x == sqlITE_OK) { NSLog(@"Personname is -->%@",[Nsstring stringWithFormat:@"%@",[_namebarray objectAtIndex:0]]); NSLog(@"BirthDates is -->%@",[_Birthdatebarray objectAtIndex:0]]); NSLog(@"BirthDates is -->%@",[_Phonearray objectAtIndex:0]]); NSLog(@"BirthDates is -->%@",[_Emailarray objectAtIndex:0]]); // if else will come here for checking weather images has added or not if added then store Yes Image if not then simply No image for default image. sqlite3_bind_text(stmt,1,[[Nsstring stringWithFormat:@"%@",[_namebarray objectAtIndex:0]] UTF8String],NulL); sqlite3_bind_text(stmt,2,[_Birthdatebarray objectAtIndex:0]] UTF8String],3,[_Phonearray objectAtIndex:0]] UTF8String],4,[_Emailarray objectAtIndex:0]] UTF8String],NulL); if(selectimage.image) { sqlite3_bind_text(stmt,5,[_arrayOfPaths objectAtIndex:0]] UTF8String],NulL); } else{ sqlite3_bind_text(stmt,@"No Image"] UTF8String],NulL); } } if (sqlite3_step(stmt) != sqlITE_DONE){} NSLog(@"Error: "); sqlite3_finalize(stmt);解决方法 我看到您的代码中没有错误,请检查您的数据库是否像这样打开
if (sqlite3_open(dbpath,&database1) == sqlITE_OK)总结
以上是内存溢出为你收集整理的ios – 在sqlite数据库中插入数据的问题全部内容,希望文章能够帮你解决ios – 在sqlite数据库中插入数据的问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)