search for part or all of a field

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

Guest

This is what I have:

select *
from Products
where
productname like ?

When I run that sentence in sql on access 2003 it comes up with nothing.
e.g. The column is ProductName and one of its rows is -->
The sims 69
Now when I type in -->
the
nothing comes up at all. What am I doing wrong?
 
I'm sorry I actually found the answer thru looking at other similar ones :

Select *
From Products
Where ProductName Like "*" & [?] & "*"

Thanks Marshall Barton 11/14/2004 :)
 
Actually that didn't work for me :(

SELECT Products.*
FROM Products
WHERE (((Products.ProductName) Like "*" & [?] & "*"))
OR (((Products.Description) Like "*" & [?] & "*"));

thing is that I'm now probably in the wrong place. It works for me on
Access, as in I put in the sql statement and execute, but I get an error on
the web page.

The Error:
HTTP Status 500 -
Description:
The server encountered an internal error () that prevented it from
fulfilling this request.
exception:
Unexpected exception : 2

I'm using JSP, and I put in two parameters but above is what I get. Any
ideas or any Ideas where I might find a prompt ans ? Thanks

TheSniipe said:
I'm sorry I actually found the answer thru looking at other similar ones :

Select *
From Products
Where ProductName Like "*" & [?] & "*"

Thanks Marshall Barton 11/14/2004 :)

TheSniipe said:
This is what I have:

select *
from Products
where
productname like ?

When I run that sentence in sql on access 2003 it comes up with nothing.
e.g. The column is ProductName and one of its rows is -->
The sims 69
Now when I type in -->
the
nothing comes up at all. What am I doing wrong?
 
Is there a chance that you need to modify the SQL syntax to be acceptable to
the back-end database you are using?

--
Good luck

Jeff Boyce
<Access MVP>

TheSniipe said:
Actually that didn't work for me :(

SELECT Products.*
FROM Products
WHERE (((Products.ProductName) Like "*" & [?] & "*"))
OR (((Products.Description) Like "*" & [?] & "*"));

thing is that I'm now probably in the wrong place. It works for me on
Access, as in I put in the sql statement and execute, but I get an error on
the web page.

The Error:
HTTP Status 500 -
Description:
The server encountered an internal error () that prevented it from
fulfilling this request.
exception:
Unexpected exception : 2

I'm using JSP, and I put in two parameters but above is what I get. Any
ideas or any Ideas where I might find a prompt ans ? Thanks

TheSniipe said:
I'm sorry I actually found the answer thru looking at other similar ones :

Select *
From Products
Where ProductName Like "*" & [?] & "*"

Thanks Marshall Barton 11/14/2004 :)

TheSniipe said:
This is what I have:

select *
from Products
where
productname like ?

When I run that sentence in sql on access 2003 it comes up with nothing.
e.g. The column is ProductName and one of its rows is -->
The sims 69
Now when I type in -->
the
nothing comes up at all. What am I doing wrong?
 
Thanks for the reply Jeff. I eventually got it working. I'm using JSP

<c:set var="sqlParameters">
%<c:out value="${param.nameField}"/>%
</c:set>
<sql:query var="display" scope="page" dataSource="${shoppingDb}">
SELECT Products.*
FROM Products
WHERE ProductName like '<c:out value="${sqlParameters}"/>'
or Description like '<c:out value="${sqlParameters}"/>'
</sql:query>

My lecturer gave it to me as just like ? and some ppl in the class can do it
like that but I guess I'm special with my special code... :)

Thanks again.

Jeff Boyce said:
Is there a chance that you need to modify the SQL syntax to be acceptable to
the back-end database you are using?

--
Good luck

Jeff Boyce
<Access MVP>

TheSniipe said:
Actually that didn't work for me :(

SELECT Products.*
FROM Products
WHERE (((Products.ProductName) Like "*" & [?] & "*"))
OR (((Products.Description) Like "*" & [?] & "*"));

thing is that I'm now probably in the wrong place. It works for me on
Access, as in I put in the sql statement and execute, but I get an error on
the web page.

The Error:
HTTP Status 500 -
Description:
The server encountered an internal error () that prevented it from
fulfilling this request.
exception:
Unexpected exception : 2

I'm using JSP, and I put in two parameters but above is what I get. Any
ideas or any Ideas where I might find a prompt ans ? Thanks

TheSniipe said:
I'm sorry I actually found the answer thru looking at other similar ones :

Select *
From Products
Where ProductName Like "*" & [?] & "*"

Thanks Marshall Barton 11/14/2004 :)

:

This is what I have:

select *
from Products
where
productname like ?

When I run that sentence in sql on access 2003 it comes up with nothing.
e.g. The column is ProductName and one of its rows is -->
The sims 69
Now when I type in -->
the
nothing comes up at all. What am I doing wrong?
 
Back
Top