1
어떤 이유로 든 "NSAssert1 (0, @"오류가 발생했습니다. '% s' ', sqlite3_errmsg (database)); " 데이터베이스를 열 때 동일한 명령문을 사용 했으므로 SQL 문은 정상입니다. 는 나는이 아주 새로운 해요SQLite iPhone SQL 선택 응용 프로그램이 작동하지 않습니다.
:-(유용한 에러가 발생하지 않지만, 낯선 내가 뭘 잘못하고 있지?
을 I가 "strSearch"밖으로 찍은 유의하시기 바랍니다 이 오류가 있지 않은지 확인 할 수 있습니다. 방법은 그것의 자신의 클래스에
- (void)searchComponents:(NSString *)strSearch {
NSString *qry;
qry = [NSString stringWithFormat:@"SELECT ID, ON_SAP, SAP_PART, SAP_DESC, MOQ FROM HONEYWELL WHERE SAP_PART LIKE '%ZX%' ORDER BY SAP_PART", strSearch];
NSLog(@"query : %@", qry);
if(searchStmt == nil) {
if(sqlite3_prepare_v2(database, [qry UTF8String] , -1, &searchStmt, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating search view statement. '%s'", sqlite3_errmsg(database));
}
// Loop through the results
if(sqlite3_step(searchStmt) == SQLITE_ROW) {
// Read the data from the result row
NSLog(@"New row selected");
}
else {
NSAssert1(0, @"Error while looping search view. '%s'", sqlite3_errmsg(database));
}
// Release the compiled statement from memory
sqlite3_finalize(searchStmt);
// Set isDetailViewHydrated as YES, so we do not get it again from the database.
isDetailViewHydrated = YES;
}
을 (커피 이름)
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
NSLog(@"Text changed %@",searchText);
Coffee *coffeObj = [[Coffee alloc] init];
[coffeObj searchComponents:@"%ZX%"];
}
MasterViewController
에서 호출 아이디어는 검색 필드에서 검색 할 때 select 문을 변경하는 것입니다. 누구든지이 작업을 수행하는 좋은 예를 알고 있습니까?
누락되었습니다 https://github.com/ccgus/fmdb – CarlJ