Search code examples
.netsqlms-accessoledb

Cannot retrieve rows from .NET OleDB.DataReader


i have a problem with a SQL Statement.

My environment is as follows:

  • VB.NET application that queries a MS Access (2002) through the .NET OleDB.DataReader

That query doesn't deliver any rows/results. But when i execute the query on the MS Access database it delivers the correct result.

The query is:

<i>select prnr.prk, prnr.prl, famk, faml from 
(fzgpr inner join prnr on prnr.id = fzgpr.prid) 
inner join prfamilie on prfamilie.id = prnr.famid 
where ((fzgpr.fzgid) = 1) and ((FamL) like '*Air*')</i>

I tried different brackets, but none worked. I noticed, that removing the second part of the where clause (and ((FamL)...) solves that issue, but i need that second part!!

I can't find the error, please help me,...


Solution

  • I want to say if you are running a query through OleDB, you have to conform to more SQL based syntax and use ((FamL) like '%Air%')

    I run a few applications off Access Databases (mine are all 2010) and that is the syntax that I use. I also use OleDB for all read access to the database.