473,440 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

Query works in Access but not with exec call from .net

Greetings all...

This has been driving me nutz and I was hoping an expert could help shed
some light.

Why does this query work in Access but not in an
OleDbCommand.ExecuteReader() call?

SELECT tblFilterPhrases_Subject.strPhrase
FROM tblFilterPhrases_Subject
WHERE ((('VIAGRA') Like '*' & [strPhrase] & '*'));
Here is the C# code I'm using:

OleDbCommand sqlCommand;
sqlCommand = new System.Data.OleDb.OleDbCommand();

try
{
sqlCommand.Connection = conn;
sqlCommand.CommandText = "exec Query1";
dreader = sqlCommand.ExecuteReader();
}

The reader comes back as not null... but it contains zero records. In Access
I run the query and it comes back with the correct record. What am I missing
here?

EB

Dec 7 '05 #1
2 1380
try using % as your wildcard character. ADO uses a different one than
Access.

Dec 7 '05 #2
<pi********@hotmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
try using % as your wildcard character. ADO uses a different one than
Access.


Thanks Pietlinden. I found what the problem is but I don't know how to fix
it. Here is my sql statement again:

SELECT tblFilter_Subject.strPhrase
FROM tblFilter_Subject
WHERE ((('VALíUMM') Like '%' & [strPhrase] & '%'));
Some of the data in strPhrase has open square brackets in it! Took me for
bleedin' ever to find that... so the next question is... how to escape an
open bracket in the situation above??

EB
Dec 7 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: jason | last post by:
I am picking up an error message on a straightforward INSERT - do I need an optimistic-type to get this working....here is is the error: Microsoft JET Database Engine error '80004005' Operation...
24
by: jason | last post by:
Hi Ray...a while ago you explained an elegant solution to enable me to CREATE and EDIT existing tables and queries inside my online access 2000 database.... could you provide refresher links on...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
1
by: Matik | last post by:
Hello to all, Maybe first small introduction: - SQLServer 2000 SP3, - XP Pro EN, - ActiveX, - SP in database It should working like this. There is a instanse of an object working, which...
12
by: John Scott | last post by:
Ok...here we go... I am trying to manually run an SQL server back up job from c#. Here is a snippet of my code to begin the process: string strSQL = "USE msdb " + "\n if exists(select * from...
6
by: AJ | last post by:
Hi all, I am trying to execute the following code: 'create recordset object SET recData = Server.CreateObject("ADODB.recordset") 'open recordset recData.Open "exec...
1
by: santaferubber | last post by:
The first query returns me the results from multiple databases, the second does the same thing except it puts the result into a #temp table? Could someone please show me an example of this using...
5
by: Jim | last post by:
Hi, I have a DLL that I want to run from the Query Analyzer. I tried the following: USE master; EXEC sp_addextendedproc BLAH, '\\Other-Server\Path\To\Blah\Blah.dll' and I get the error:
1
by: Vinod Sadanandan | last post by:
A Roadmap To Query Tuning ============================ For each SQL statement, there are different approaches that could be used to retrieve the required data. Optimization is the process of...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.