Query works in Access, but not VB .NET
I'm a relatively new programmer, and I'm attempting to duplicate an Access query in to VB .NET. I expected this to be a simple copy/paste from Access, but that has not been the case. When I attempt to run the following query from Access, I get a ton of records. From VB .NET in a AccessDataSource control, I get nothing. Here's the query:
And here's the code (which has worked fine with other queries):
Any ideas would be greatly appreciated! I've burned 99% of my brain on this today. Thanks!
Last edited by Brad Jones; 10-02-2012 at 11:35 AM.
Oops you missed a couple of imbeded quotes: "06/2007" should be ""06/2007""
Originally Posted by corygibbons
Ok, I see the code now. You caught the quote problem there. Never mind!
Is that Expr1 field a Date field or a text field in your table? If its a date field then you will want to wrap the value with the "#" chars.
"HAVING ((([dbo_dbStats Count Calls Monthly].Expr1)=#06/2007#));"
Thanks for trying. It is a text field, but I tried the # characters just in case, and still received no data.
What's strange is, when I change the INNER JOIN to a LEFT JOIN, I get partial data back, but not entirely what I'm looking for.
If anyone else has any other ideas they would be much appreciated.
Welp, looks like this was a lot easier than I thought!
Found a 'like string*' statement in the dbo_dbStats Count Optouts Monthly, replaced with 'like string%' and worked like a charm.
Thanks again for the help.
I didnt see that in the query but now that you posted i see there were some nested query calls to other queries where you obviously found the issue.
The issue why it works in Access and not in your code is because within Access the * is the wild card character while when using ADO the % sign is the wild card character.
By miki in forum VB Classic
Last Post: 01-07-2003, 03:20 PM
By David Jones in forum Database
Last Post: 08-31-2001, 01:22 PM
By Scott in forum VB Classic
Last Post: 05-12-2001, 05:17 PM
By Bill Seddon in forum .NET
Last Post: 02-01-2001, 03:49 AM
By Fred in forum VB Classic
Last Post: 05-12-2000, 05:38 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL