Hi Duncan,
Thanks for your response. I am calling the same userDefaults somewhere else in my project and it works fine. I am querying the same thing somewhere else and it seems to be working there.
Let me show you more of my code... I took a variable out of my query and just sticking to one for now...maybe I am doing something wrong:
sqlite3 *database;
// Open the database from the users filessytem
if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *brandName = [defaults stringForKey:@"selectedBrand"];
NSString *sqlStr = [NSString stringWithFormat:@"select * from vehicleInfo where brandName = '%@'", brandName];
const char *sqlStatement = [sqlStr UTF8String];
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
// Loop through the results and add them to the feeds array
while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
// Read the data from the result row in column 2
NSString *aName = [NSString stringWithUTF8String

char *)sqlite3_column_text(compiledStatement, 2)];
[defaults setObject:aName forKey:@"selectedSpur"];
}
}
//Release the compiled statement from memory
sqlite3_finalize(compiledStatement);
}
sqlite3_close(database);