0

Hi I have written a code to read from excel sheets and query them according to filter set But am stuck at

Select * from [sheetname] where [col] not like '%something%'

How can I write the not part? Rest all query just work fine The one above ignores the not and executes

4
  • have you tried the NOT operator '<>'? Commented Mar 21, 2014 at 13:08
  • 1
    NOT LIKE should work - what errors/bad results are you getting? Commented Mar 21, 2014 at 13:09
  • Without seeing more of your code it's tough to guess what could help...maybe storing your data in a datatable and using a rowfilter would help? Commented Mar 21, 2014 at 13:11
  • Please post some sample data, show the exact query you're using, and show what the output is, and explain why that output isn't what you were expecting. Commented Mar 21, 2014 at 13:36

2 Answers 2

1

If you don't have to use ADO and OLE to read your spreadsheet, I would recommend using EP Plus. It's a project that allows you to work with Spreadsheets in a much better OOP paradigm. It also abstracts all of the gotchas that come from the different internal formatting of .xlsx files versus the older .xls files.

Sign up to request clarification or add additional context in comments.

3 Comments

It's like almost I am doing the same thing but only to filter I am not getting the query rest I can select rows on condition EQUAL TO or like just can't do is NOT LIKE
@aadilsiddiqui Why can't you use NOT LIKE? It's perfectly valid syntax. Are you getting an error or bad results?
I get the same result as by using LIKE, it seems like it's ignoring the NOT part
0

Is it just you don't have quotes around %something%?

Check out this if you want to melt your brain with Excel possibilities (search the comments for 'not like'), and perhaps solve your problem at the same time.

1 Comment

I do have quotes '%something%'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.