SelectCommand Where LIKE ? + '%'
Posted on 2005-05-15
I've configured a data adaptor so I can search on letters I select from a ComboBox.
I've done this before with no problems but this one I cannot get to work!!!
Theres only 4 coloumns in a table named ServiceDetails from a data base called Repairs.
Coloumn 0 is Brand
Coloumn 1 is Company
Coloumn 2 is CustomerID
Coloumn 3 is DocketNumber
Coloumn 4 is Model
If I click on the data adaptor(daService) and check properties the selectcommand commandtext looks like this
SELECT Brand, Company, CustomerID, DocketNumber, Model
WHERE (Company LIKE ? + '%')
ORDER BY DocketNumber DESC
if I check parameters everything looks good.
In the form load section i've writtern this
When I run the program i get this message:
"An unbalanced exception of type ' System Data.oleDB.exception' occured in system.data.dll "
and this line is highlighted daService.fill(dsService)
If I remove the where (Company LIKE ? + '%') from the query table then 'no problem'
but of coarse I cannot use the selectcommand.parameters statement.
Wierd thing is if I do this with another table in the same Database(Repairs) with a data adaptor daCustomers then it all works.
Everything looks identical.
Can anyone shine some light on this.
Using Access2000 and VB.net