I'm working wit an app that takes strings from the user and saves it to the database. After checking the code again and again, the strings aren't getting into the database. For example if I add a string like "abc", I'm getting the message STRING ADDED but on opening the database in sqlite manager, null is inserted in place of abc. Can anyone guide me? I'm using xcode 4.2 and developing for iPhone.
Asked
Active
Viewed 507 times
0
-
2You need to provide sample code for others to really see the problem. – barley Jun 09 '12 at 16:17
-
That usually happens if you have set the data type of your colum to integer and you try to insert a string. Be sure to check that. – libjup Jun 09 '12 at 16:26
-
Solved it!! I just added NSString *insertSQL = [NSString stringWithFormat:@"INSERT INTO strings (string) VALUES (\"%@\")",textfield.text]; Instead of NSString *insertSQL = [NSString stringWithFormat:@"INSERT INTO strings (string) VALUES (?)",textfield.text]; – Ingila Ejaz Jun 09 '12 at 17:51