Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have sqlite implemented in my xcode project. It gets its data from a UITextField. There is a texField that gets added programmatically everytime the user clicks a button. I will be recreating the 'same' textField. (Kind of.) How can I get the textField's data to the sqlie file?

SQLite Created in Terminal
SQL
CREATE TABLE myDB(myDBID integer primary key, first text, second text);


Objective C
Objective-C
NSString *query = [NSString stringWithFormat:@"insert into myDB values(null, '%@', '%@')", self.textView1.text, self.textView2.text];
[self.dbManager executeQuery:query];

//IBAction:
UITextField *text = [[UITextField alloc] initWithFrame:frame];
[self.view addSubview:text];


How can I add the programmatically added textField's text to the sqlite database?
Posted

1 solution

You will only get the text-string of your textfield in the database. If you have a varying count of textfields you must save the count or some logic would should recreated.

You need to run an INSERT QUERY on SQLite.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900