selectSQL = [NSString stringWithFormat: @"select text, question.sort, name from Question, main where main.key=question.key and var=\"%@\"", selectVar];
else
selectSQL = [NSString stringWithFormat: @"select text, question.sort from Question, main where main.key=question.key and name=\"%@\" and var=\"%@\"", selectYear, selectVar];
NSString *sqlPath = [[NSBundle mainBundle] pathForResource:DB_BaseName ofType:@"sqlite"];
FMDatabase *myDB = [[FMDatabase alloc] initWithPath:sqlPath];
[myDB open];
// subgroupPicArray = [[NSMutableArray alloc] init];
a = selectYear;
b = selectVar;
if([selectYear isEqualToString:@""])
selectSQL = [NSString stringWithFormat: @"select text, question.sort, name from Question, main where main.key=question.key and var=\"%@\"", selectVar];
else
selectSQL = [NSString stringWithFormat: @"select text, question.sort from Question, main where main.key=question.key and name=\"%@\" and var=\"%@\"", selectYear, selectVar];
FMResultSet *results = [myDB executeQuery:selectSQL];
while([results next]){
if([[results stringForColumn:@"Text"] isEqualToString:@""]){
myHTML = [NSString stringWithFormat: @"%@",selectVar,[results stringForColumn:@"sort"]];
// Добавление картинок в тело письма
NSString *TestIMG = [results stringForColumn:@"sort"];
if (![TestIMG isEqual: @""]){
TestIMG =[NSString stringWithFormat: @"%@.jpg",TestIMG];
// TestIMG = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:TestIMG ofType:@"jpg"]];
NSData *imageData = ([UIImage imageNamed: TestIMG],1);
[mc addAttachmentData:imageData mimeType:@"" fileName:TestIMG];
}
} else
// Формирование текста страницы просмотра
myHTML = [NSString stringWithFormat: @"%@
%@