Rani , you have not mentioned What database you are using i.e core data or SQLite. As You have mentioned you have already saved integer values in database all you need to do is
int WEEKDAY_INTVALUE
while (sqlite3_step(statement) == SQLITE_ROW) {
WEEKDAY_INTVALUE = sqlite3_column_int(statement, 0);
NSLog(@"The value is %d ", fieldValue);
}
Once you grab the int value you can use a predefined Enum to get the string value using something like
typedef enum {
SUNDAY = 0,
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY
}WEEKDAYS;
You can pass this integer value grabbed using a switch case and assign the Weekday text by something like
switch (WEEKDAY_INTVALUE) {
case SUNDAY:
[lbl setText:@"Sunday"];
break;
default:
break;
}
EDIT://Use of WEEKDAYS Enum
If you take use of datamodels such as follows
@interface Anything : NSObject {
WEEKDAYS savedWeekDay;
NSString* someField;
}
Now When you create Objects of this "Anything" class such as
NSMutableArray* arrAllObjects = [[[NSMutableArray alloc] initWithCapacity:0] autorelease];
while (sqlite3_step(statement) == SQLITE_ROW) {
Anything* object = [[Anything alloc] init];
object.savedWeekDay = sqlite3_column_int(statement, 0);
object.someField = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)];
[arrAllObjects addObject:object];
[object release];
}
You later pass this array from your DBCommunicator to your ViewController. Though this datamodel approach does not directly relate to your question statement but this is the way I use database handling in my applications. Hope you can take some hint from it.