вот как я пытаюсь добавить данные в базу данных sqlite, все работает отлично, но данные не добавляются в базу данных, я не понимаю, почему вы можете направить код и сказать мне, что я делаю неправильнопроблема при вставке данных в базу данных sqlite
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 -->%@",[NSString stringWithFormat:@"%@",[_Birthdatebarray objectAtIndex:0]]);
NSLog(@"BirthDates is -->%@",[NSString stringWithFormat:@"%@",[_Phonearray objectAtIndex:0]]);
NSLog(@"BirthDates is -->%@",[NSString stringWithFormat:@"%@",[_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],-1, NULL);
sqlite3_bind_text(stmt, 2, [[NSString stringWithFormat:@"%@",[_Birthdatebarray objectAtIndex:0]] UTF8String],-1, NULL);
sqlite3_bind_text(stmt, 3, [[NSString stringWithFormat:@"%@",[_Phonearray objectAtIndex:0]] UTF8String],-1, NULL);
sqlite3_bind_text(stmt, 4, [[NSString stringWithFormat:@"%@",[_Emailarray objectAtIndex:0]] UTF8String],-1, NULL);
if(selectImage.image)
{
sqlite3_bind_text(stmt, 5, [[NSString stringWithFormat:@"%@",[_arrayOfPaths objectAtIndex:0]] UTF8String],-1, NULL);
}
else{
sqlite3_bind_text(stmt, 5, [[NSString stringWithFormat:@"%@",@"No Image"] UTF8String],-1, NULL);
}
}
if (sqlite3_step(stmt) != SQLITE_DONE){}
NSLog(@"Error: ");
sqlite3_finalize(stmt);
Что вы имеете ввиду * данные не добавляются в базу данных * ?, вы получаете сообщение об ошибке? – tkanzakic
Я не получаю ошибку, просто база данных не заполняется –
где находится файл базы данных, хранящийся в комплекте приложения или в каталоге документов? – tkanzakic