I've got a Sqlite database setup such as this

ID          Question          AnswerA         AnswerB         AnswerC          AnswerD

1

2

3

and what I wish to do is pull from the random row 1,two or three and display it on my UIView that has 5 UITextFields one for that question and 4 for that 4 Solutions. I have been through a lot of lessons regarding how to generate a Sqlite database and display it on the UITableView utilizing a Navigation-based Application, but that is not what I am searching for. I wish to make use of a View-based Application and display the questions and solutions on my small UIView.

(A Good Example SQLite based apple iphone Application - Techotopia)

This is among the many lessons I have been through about sqlite within the apple iphone. The only issue with that one is the fact that he is not tugging data from a existing database he constructed with Sqlite. He's getting the consumer enter data around the apple iphone that is saving it to some database after which tugging it out, less than what I am searching for.

This is exactly what I am dealing with,

#import <UIKit/UIKit.h>
#import "/usr/include/sqlite3.h"

@interface database1ViewController : UIViewController {

    UITextField *Question;
    UITextField *AnswerA;
    UITextField *AnswerB;
    UITextField *AnswerC;
    UITextField *AnswerD;
    NSString *databasePath;

    sqlite3 *contactDB;

}

@property (retain, nonatomic) IBOutlet UITextField *Question;

@property (retain, nonatomic) IBOutlet UITextField *AnswerA;

@property (retain, nonatomic) IBOutlet UITextField *AnswerB;

@property (retain, nonatomic) IBOutlet UITextField *AnswerC;

@property (retain, nonatomic) IBOutlet UITextField *AnswerD;

@end

and my implementation file is,

#import "database1ViewController.h"

@implementation database1ViewController

@synthesize Question, AnswerA, AnswerB, AnswerC, AnswerD;

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

    NSString *docsDir;
    NSArray *dirPaths;

    dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    docsDir = [dirPaths objectAtIndex:0];

    // Build the path to the database file
    databasePath = [[NSString alloc] initWithString: [docsDir stringByAppendingPathComponent: @"Questions.sql"]];

    NSFileManager *filemgr = [NSFileManager defaultManager];

    if ([filemgr fileExistsAtPath: databasePath ] == NO)
    {
        const char *dbpath = [databasePath UTF8String];

        if (sqlite3_open(dbpath, &contactDB) == SQLITE_OK)
        {
            char *errMsg;
            const char *sql_stmt = "CREATE TABLE IF NOT EXISTS Questions (ID INTEGER PRIMARY KEY AUTOINCREMENT, QUESTION TEXT, ANSWERA TEXT, ANSWERB TEXT, ANSWERC TEXT, ANSWERD TEXT)";

    [super viewDidLoad];
}



/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {

    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;

    self.Question = nil;

    self.AnswerA = nil;

    self.AnswerB = nil;

        self.AnswerC = nil;

        self.AnswerD = nil;

}


- (void)dealloc {

    [Question release];

        [AnswerA release];

        [AnswerB release];

        [AnswerC release];

        [AnswerD release];

        [super dealloc];

}

@end

I'm lost since I've been dealing with a lot of lessons, if a person could correct things i have and have great results that might be awesome! I attempted to really make it as obvious as you possibly can.