I am attempting to write an application in which I have two text fields that I will be using for input. The input taken from the text fields are being initialized as a string. So what I want to accomplish is:
I realize this is very specific, but I have been having a difficult time finding anything simple to accomplish this. I am very new to iOS development and I appreciate if anyone could be as specific and detailed as possible, or at least point me to some resources that would teach me how to accomplish this.
I am using Xcode v4.3.2 and I do not use Storyboard or ARC. I tried to be as detailed as possible, but as you can, my goal is really simple.
I'm tapped out and I appreciate all the help I can get.
Thanks! -Matt
a simple query snippet looks like:
NSString *querystring;
// create your statement
querystring= [NSString stringWithFormat:@"SELECT text1, text2 FROM datatable;"];
const char *sql = [querystring UTF8String];
NSString *text1 = nil;
NSString *text2 = nil;
if (sqlite3_prepare_v2(db, sql, -1, &statement, NULL)!=SQLITE_OK){
NSLog(@"sql problem occured with: %s", sql);
NSLog(@"%s", sqlite3_errmsg(db));
}
else
{
// you could handle multiple rows here
while (sqlite3_step(statement) == SQLITE_ROW) {
text1 = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 0)];
text2 = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 1)];
} // while
}
sqlite3_finalize(statement);
// go on with putting data where you want
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With