就在它完美运行之前的片刻,突然不知道发生了什么并且没有改变任何东西,但它不再工作了尝试了这么多,但无法弄清楚我错过了什么任何帮助对我来说就像天堂一样下面是我的代码
这就是我的日期在我的 sqlite 数据库 01/20/1978 中的样子
01/20/2013
02/28/1979
MM/dd/yyyy
NSLog(@"Fetching holidays from the database between %@ and %@...", fromDate, toDate);
// fromdate and todate both are nsdate this is what they prints
// Fetching holidays from the database between 2013-06-29 18:30:00 +0000 and 2013-08-03 18:29:59 +0000...
NSDateFormatter *fmt = [[[NSDateFormatter alloc] init] autorelease];
NSString *query4 = [[NSString alloc] initWithFormat:@"select Birthdates,Names,Profilepic,Email,Phonenumber from PersonNamesAndBirthDates where Birthdates between ? and ?"];
sqlite3_stmt *stmt4;
int x4 = sqlite3_prepare_v2(database1,[query4 UTF8String],-1, &stmt4, nil);
if (x4 == SQLITE_OK)
[fmt setDateFormat:@"MM/dd/yyyy"];
sqlite3_bind_text(stmt4, 1, [[fmt stringFromDate:fromDate] UTF8String], -1, SQLITE_STATIC);
sqlite3_bind_text(stmt4, 2, [[fmt stringFromDate:toDate] UTF8String], -1, SQLITE_STATIC);
//**IT WAS GOING IN WHILE BUT NOW ITS NOT GOING IN SO IT JUST JUMP FROM HERE**
while(sqlite3_step(stmt4) == SQLITE_ROW)
{
NSString *name = [NSString stringWithUTF8String:(char *)sqlite3_column_text(stmt4, 0)];
NSString *proPic = [NSString stringWithUTF8String:(char *)sqlite3_column_text(stmt4, 1)];
NSString *email = [NSString stringWithUTF8String:(char *)sqlite3_column_text(stmt4, 2)];
NSString *pNumber = [NSString stringWithUTF8String:(char *)sqlite3_column_text(stmt4, 3)];
NSString *bDate = [NSString stringWithUTF8String:(char *)sqlite3_column_text(stmt4, 4)];
[holidays addObject:[Holiday holidayNamed:name email:email profilePic:proPic phoneNumber:pNumber date:[fmt dateFromString:bDate]]];
NSLog(@"%@",holidays);
}
sqlite3_finalize(stmt4);
NSLog(@"%@",holidays);
sqlite3_close(database1);
[delegate loadedDataSource:self];
}