query returns rows from access but not from .Net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
This might be a .Net question but I thought I'd ask anyway.
The following query returns 46 rows if run as an access query but no rows if
the same SQL string is used form within VB.Net.
Go figure...I've spent 2 hours on this.

Any help?
Thanks.

From ACCESS:
SELECT instrSec, AssignNAME, ItemName, FullName, CMP_EOW FROM 032Portfolios
, MMLBenchMarks where AssignNAME = ItemName GROUP BY instrSec, AssignNAME,
ItemName, FullName, CMP_EOW HAVING (((MMLBenchMarks.CMP_EOW)=7 Or
(MMLBenchMarks.CMP_EOW)=6)) and instrSec like('*CMP*') order by FullName

From .Net:

Dim strSqlCMP As String
strSqlCMP = "SELECT instrSec, AssignNAME, ItemName, FullName, CMP_EOW FROM
032Portfolios , MMLBenchMarks where AssignNAME = ItemName GROUP BY instrSec,
AssignNAME, ItemName, FullName, CMP_EOW HAVING (((MMLBenchMarks.CMP_EOW)=7 Or
(MMLBenchMarks.CMP_EOW)=6)) and instrSec like('*CMP*') order by FullName"
Dim objCMP As New OleDbDataAdapter(strSqlCMP, conn)
objCMP.Fill(ds, "ds_OnTimeCMPNames")
 
Access/Jet supports two different SQL dialects. You are looking
at the dialect used by default in Access.

In ADO.Net, you should use C wildcards instead of MSDOS wildcards,
ie % instead of * in your SQL.

(david)
 
Use '%' instead of '*' as the wildcard character when executing JET queries
via ADO.NET or ADO 'classic'.
 
Thank you!

david epsom dot com dot au said:
Access/Jet supports two different SQL dialects. You are looking
at the dialect used by default in Access.

In ADO.Net, you should use C wildcards instead of MSDOS wildcards,
ie % instead of * in your SQL.

(david)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SQL help please 1
Problem with query returning one record 4
Module/Prgramming Help 2
HELP FORMULATING COUNT IN QUERIES 5
SQL Rowsource 1
In a STATIC corner 1
Selecting Top 3 - Subquery won't work 5
Select Query 3

Back
Top