tags:

views:

23

answers:

1
NSString * strSearchSql = [NSString stringWithFormat:@"SELECT pdf_id,pdf_name,page_no,pdf_image,pdf_text FROM search WHERE pdf_text LIKE '\%%@\%'",strSearchString];

In This Query i got the String like given below

SELECT pdf_id,pdf_name,page_no,pdf_image,pdf_text FROM search WHERE pdf_text LIKE '%@'

I want like this

SELECT pdf_id,pdf_name,page_no,pdf_image,pdf_text FROM search WHERE pdf_text LIKE '%searchtext%'

Please give me hint or provide me a document.

A: 

Escape the % symbols in your query like this %% instead of \%.

NSString *strSearchSql = [NSString stringWithFormat:@"SELECT pdf_id,pdf_name,page_no,pdf_image,pdf_text FROM search WHERE pdf_text LIKE '%%%@%%'", strSearchString];
BoltClock