Problems with LIKE in SQL

V

VB Programmer

Using ASPX page with Access db.

When I run a query in Access it returns many records. When I run it via
ADO.NET it returns 0.

It uses a LIKE statement in the WHERE clause. Here's the statement:
SELECT [Employees].[LastName] & ', ' & [Employees].[FirstName] AS AreaMgr,
Stores.StoreName AS StoreName, Stores.StoreId AS StoreId,
Stores.NumberQCRequired AS NumberQCRequired, Plan.PlanDate AS PlanDate,
Employees.RegionalDirectorId, Stores.StoreTypeId FROM (Employees INNER JOIN
Stores ON Employees.EmployeeId = Stores.AreaManager) LEFT JOIN Plan ON
Stores.StoreId = Plan.StoreId WHERE ((Plan.PlanDate >= #9/1/2004# AND
Plan.PlanDate < #10/1/2004#) Or (Plan.PlanDate Is Null)) AND
(Stores.StoreName LIKE 'Home*') ORDER BY Stores.StoreName, Plan.PlanDate;

Any ideas?

Thanks!
 
V

VB Programmer

Thanks.

What is the symbol for only 1 character?

Jay Pondy said:
Change the '*' to '%'

VB Programmer said:
Using ASPX page with Access db.

When I run a query in Access it returns many records. When I run it via
ADO.NET it returns 0.

It uses a LIKE statement in the WHERE clause. Here's the statement:
SELECT [Employees].[LastName] & ', ' & [Employees].[FirstName] AS AreaMgr,
Stores.StoreName AS StoreName, Stores.StoreId AS StoreId,
Stores.NumberQCRequired AS NumberQCRequired, Plan.PlanDate AS PlanDate,
Employees.RegionalDirectorId, Stores.StoreTypeId FROM (Employees INNER JOIN
Stores ON Employees.EmployeeId = Stores.AreaManager) LEFT JOIN Plan ON
Stores.StoreId = Plan.StoreId WHERE ((Plan.PlanDate >= #9/1/2004# AND
Plan.PlanDate < #10/1/2004#) Or (Plan.PlanDate Is Null)) AND
(Stores.StoreName LIKE 'Home*') ORDER BY Stores.StoreName, Plan.PlanDate;

Any ideas?

Thanks!
 
V

VB Programmer

I found it: _

VB Programmer said:
Thanks.

What is the symbol for only 1 character?

Jay Pondy said:
Change the '*' to '%'

VB Programmer said:
Using ASPX page with Access db.

When I run a query in Access it returns many records. When I run it via
ADO.NET it returns 0.

It uses a LIKE statement in the WHERE clause. Here's the statement:
SELECT [Employees].[LastName] & ', ' & [Employees].[FirstName] AS AreaMgr,
Stores.StoreName AS StoreName, Stores.StoreId AS StoreId,
Stores.NumberQCRequired AS NumberQCRequired, Plan.PlanDate AS PlanDate,
Employees.RegionalDirectorId, Stores.StoreTypeId FROM (Employees INNER JOIN
Stores ON Employees.EmployeeId = Stores.AreaManager) LEFT JOIN Plan ON
Stores.StoreId = Plan.StoreId WHERE ((Plan.PlanDate >= #9/1/2004# AND
Plan.PlanDate < #10/1/2004#) Or (Plan.PlanDate Is Null)) AND
(Stores.StoreName LIKE 'Home*') ORDER BY Stores.StoreName, Plan.PlanDate;

Any ideas?

Thanks!
 

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

Top