I'm attempting to connect with a SQLite database and also have a method that identifies a particular row in the database (the very first column within the database is “ID” and it is a principal key) then extract the data from the couple of other posts for the reason that row and display them in text fields.

This is employed for an easy Trivia game I'm making I'll later create a random method which will pick the row randomly.

I've been battling with this particular problem for many days and I've been through lots of lessons but these cope with exhibiting the information inside a table view, I wish to display it really on text fields inside a View based application. I'm fairly confused at this time so any help beginning from loading the database to exhibiting the information within the text fields could be GREATLY APPRECIATED!

Thanks!

Connect to libsqlite3.dylib (and import <sqlite3.h>) to gain access to the energy of SQLite. You will find numerous lightweight Objective-C front finishes and It is best to select one. Within this example, I personally use fmdb (https://github.com/ccgus/fmdb) to see what they are called of individuals from a formerly produced database:

NSString* docsdir = [NSSearchPathForDirectoriesInDomains( 
    NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString* dbpath = [docsdir stringByAppendingPathComponent:@"people.db"];
FMDatabase* db = [FMDatabase databaseWithPath:dbpath];
if (![db open]) {
    NSLog(@"Ooops");
    return;
}
FMResultSet *rs = [db executeQuery:@"select * from people"];
while ([rs next]) {
    NSLog(@"%@ %@", 
        [rs stringForColumn:@"firstname"], 
        [rs stringForColumn:@"lastname"]);
}
[db close];
/* output:
Snidely Whiplash
Dudley Doright
*/

That demonstrates speaking towards the database knowing SQL can be you (and it is another subject). You can a formerly built SQLite file inside your application bundle, however, you can't email it there the answer would be to copy it out of your application bundle into another location, like the Documents directory, before you begin dealing with it.

Finally, to place strings into text fields (UITextField), set their text property. So for instance rather than the while loop proven above, where I log the database results, I possibly could use individuals leads to set text area values:

myTextField.text = [rs stringForColumn:@"firstname"];
myOtherTextField.text = [rs stringForColumn:@"lastname"];