Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am trying to get data from my Access database using like operator. For example my ProducID contains NoteBook, Notes etc. Using like operator, I want to get them all shown if user types No etc.
Like operator did not give any errors but it only shows record when I put full NoteBook (does not show for Notes offcourse)

Please note I want to use the query in dataset.


Please advise how to fix it.
Thanks
Posted
Comments
[no name] 25-Nov-11 11:21am    
How are you forming the query?
Chris Meech 25-Nov-11 11:23am    
Could you please add some code snippet. Especially some lines that show how the SQL is put together. Thanks.
Furqan Sehgal 25-Nov-11 11:32am    
Please check the link, I have put pic. there
http://stackoverflow.com/questions/8271659/how-to-get-data-using-like-operator

Im not sure with Access, but I do it in SQL Server like this:

SELECT * FROM [TABLENAME] WHERE No = '%' + @No + '%'


Best regards,
Eduard
 
Share this answer
 
This may be obvious but did you put in the "*" ... LIKE "Note*"
 
Share this answer
 
You didn't show the query you were using so this is just a guess, but make sure it is like this

select ... from table where column LIKE 'Note%'


The % is a wildcard and will find anything that begins with the characters 'Note' so it will match Notebook and Notes
 
Share this answer
 
Comments
Furqan Sehgal 25-Nov-11 11:38am    
So I put it like where column LIKE '?%'
This did not return any data, I have made sure NoteBooks and Notes is there in my database.
I Found that Only few SQL Queries are working properly in MS Access...
Some Query Give Wrong Results, Throws Expectations, So It's Advised to Create Query in Access Database and Call that by Using ODBC or OLEDB Command...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900