I am trying to pull data from an Access 2003 database using ADO and vb.net. For some reason, my query does not return any results when I send it programmatically, but when I use the exact same query in the Access query designer it works fine. The issue has to do with the LIKE condition in my WHERE clause.
Here is my query:
SELECT IndexNumber, Manufacturer, Model, SerialNumber, ItemNumber, Description " _
& "FROM Inventory " _
& "WHERE ProductCondition= 'New' " _
& "AND DateDelivered= #12/30/1899# " _
& "AND Manufacturer= '" & Manufacturer & "' " _
& "AND Model LIKE '*" & Model & "*' " _
& "ORDER BY Manufacturer, Model, SerialNumber"
Manufacturer and Model are string variables.
The problem is definitely with the LIKE condition because when I remove the * symbols it works fine. For example, if Model = 'Airplane' it will return everything where the Model is Airplane, but if Model = '*plane*' then it returns nothing. I have tried exchanging the * wildcard symbol for % and for ? but I still get no results back.
Does anyone know how to fix this issue? If you need more details then let me know.
Here is my query:
SELECT IndexNumber, Manufacturer, Model, SerialNumber, ItemNumber, Description " _
& "FROM Inventory " _
& "WHERE ProductCondition= 'New' " _
& "AND DateDelivered= #12/30/1899# " _
& "AND Manufacturer= '" & Manufacturer & "' " _
& "AND Model LIKE '*" & Model & "*' " _
& "ORDER BY Manufacturer, Model, SerialNumber"
Manufacturer and Model are string variables.
The problem is definitely with the LIKE condition because when I remove the * symbols it works fine. For example, if Model = 'Airplane' it will return everything where the Model is Airplane, but if Model = '*plane*' then it returns nothing. I have tried exchanging the * wildcard symbol for % and for ? but I still get no results back.
Does anyone know how to fix this issue? If you need more details then let me know.