Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Query gets different results from .Net - Help! 1

Status
Not open for further replies.

jacktripper

Programmer
Dec 5, 2001
124
US
I am in the process of moving a bunch of queries from Access 2003 into a VB.Net application. The query still runs against the Access MDB file, though.

They all work fine but one. Its a fairly large, convulted series of IIf statements and calculations. It runs, but the results are slightly off mathematically.

I take the EXACT sql text, and run it in Access, and the numbers are correct. But, the VB.Net results are wrong.

Any ideas on why this would be? To me, SQL is SQL, so why should I get different results regardless of whether running from a windows app versus direct access?

Has anyone had a similar problem?


 
The two things I can think of in my past.

1. are there any syntax in your query not compatible with both, ie. how you join

2. have you tried cutting out some of your query to see where the problem occurs.

3. are you sure the same data for the query is getting past in?

Not specific but it is what I have found in the past to help me..

Thanks
Thom
 
I will experiment on separating parts of it out. I know I can eliminate a lot of it, because the problem is only in 2 results out of about 10 calculations. Something with those 2 calculations is giving it fits...
 
The problem seemed to be in the use of the "Like" or "Not Like" parts of the query. Where it said XValue Not Like "*this*", it always returned TRUE when it should not have.

By change it to parse the string variable instead of using LIKE or NOT LIKE, it works.

Strange
 
In ADO, you must use the % sign instead of the * for LIKE statements.

See my old post thread222-1578661.

IHTH


Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.

My newest novel: Wooden Warriors
 
Thanks for proving your knowledge after the fact.

Would you recommend I use a different search or question for this problem so that I would have found your previous post?

What should I have searched for to find your answer?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top