ios - How to select row in FMDB? -
friends used fmdb , working well, tryed select single row gives me error
this code
fmresultset *fresult= [db executequery:@"select * contents id = 1"]; [fresult next]; nslog(@"%@",[fresult stringforcolumn:@"title"]);
thank you
you should check results. example:
fmresultset *rs = [db executequery:@"select * contents id = 1"]; if (!rs) { nslog(@"%s: executequery failed: %@", __function__, [db lasterrormessage]); return; } if ([rs next]) { nsstring *title = [rs stringforcolumn:@"title"]; nslog(@"title = %@", title); } else { nslog(@"%s: no record found", __function__); } [rs close];
you flying blind if don't (a) check executequery
return code; , (b) if failed, examine lasterrormessage
know why didn't work.
Comments
Post a Comment