I have a form(table view) which contains textfields and textview as subviews,I need to save the data filled in those fields.Hence I used sqlite3.Everything works fine,saving retrieving and displaying saved data.But in the table view,I have one cell which contains a button as subview.As we know that there’s no concept called checkbox button in iphone.Therefore I used button and added default image as subview shown in the following:
When the button is not selected,the image is unchanged.
Now that if the user selects the button the image changes to check mark indicating that the logic works every year as shown in the following:

Now my question is how can I save the button image in to sqlite3.I have used the following query to insert values:
NSString *insertSQL = [NSString stringWithFormat:@"INSERT INTO reminders(name,event,date,tim,bfr,num,bod,grp) VALUES (\"%@\", \"%@\", \"%@\", \"%@\", \"%@\",\"%@\", \"%@\", \"%@\")", fieldOne.text, fieldTwo.text,fieldThree.text,fieldFour.text,fieldFive.text,fieldSix.text,textView.text,fieldSeven.text];
Similarly how can I save the button with image as subview in sqlite3.I heard that there is no concept like BOOL values storage in sqlite3.Instead it is stored as int values i.e. “0” as false and “1” as true.Hence I used the following query to insert the button image:
int selValue;
if(checkboxSelected == NO)
{
selValue = 0;
}
else if(checkboxSelected == YES)
{
selValue = 1;
}
NSString *insertSQL = [NSString stringWithFormat:@"INSERT INTO reminders(name,event,date,tim,bfr,val,num,bod,grp) VALUES (\"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\",\"%@\", \"%@\", \"%@\")", fieldOne.text, fieldTwo.text,fieldThree.text,fieldFour.text,fieldFive.text,isSelected,fieldSix.text,textView.text,fieldSeven.text];
In console the selValue is getting displayed as 1 if button’s selected and 0 if not.
But I have a controller page called view edit reminder,where the user can view the saved reminder and edit for changes to happen.Now I have saved a reminder called Amma,there while saving I have selected Every Year button,but its not working even though the data inserted is getting retrieved for the reminder as shown below:

EDIT:
The code I have implemented for retrieving the data from sqlite3 database table:
ReminderClass *remind = [[ReminderClass alloc]init];
remind.Name = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 1)];
remind.Event = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 2)];
remind.Date = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 3)];
remind.time = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 4)];
remind.numDays = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 5)];
remind.selString = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 6)]];
remind.number = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 7)];
remind.msgBody = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 8)];
remind.remGroup = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statment, 9)];
EDIT:
This is what I did for editing the content:
-(void)tableView:(UITableView *)atableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (aTable.editing)
{
ReminderClass *rem = (ReminderClass *)[self.monthArray objectAtIndex:indexPath.section];
// Instantiate your detail/editor view controller,
// and pass in the ReminderClass object to be edited.
ERAddReminderViewController *rdvc = [[[ERAddReminderViewController alloc]initWithReminder:rem]autorelease];
[self.navigationController pushViewController:rdvc animated:YES];
}
[atableView deselectRowAtIndexPath:indexPath animated:YES];
}
Please help me out with your valuable suggestions
Thanks all in advance 🙂
setting:
Get: