Hi Nitin,
u must have got Empfname and Emplname from HTML page stored in String
variables in ur servlet say f_var & l_var .
Now u can frame SQL query in ur program as -
Strin SQLStmt = "Select * from Empdet where Empfname like '%"+f_var+"%' AND
Emplname like '%"+l_var+"%' (Pl note SQL specific syntax).
This should work ..
In SQL u give query like -
select * from Empdet where Empfname like '%abc%' and Emplname like '%pqr%'
(I am supposing Empfname and Emplname can contain the pattern sent through
HTML page). If I am missing some point specific to ur problem, u can
reframe the query.
-mukul
At 05:22 PM 7/15/99 +0530, you wrote:
>Hello All
>
>We are trying to develop an servlet which talks with the MS-ACCESS
>database..
>
>We are also using prepared statement in the process. However we are
>facing problems in supplying parameters to the query at run time
>
>The querystring is as follows
>
>"Select * from Empdet where Empfname like ? AND Emplname like ? ";
>
>We are accepting the first name and last name from the HTML page..
>
>To run on the Ms-Access the query should be like this
>
>Select * from Empdet where Empfname like '*<some char>*' AND Emplname
>like '*<some char>*' ";
>
>So we appended the '* and *' chars to the data accepted from the user
>and then inserted in the place of ? marks(place holders) using the
>setString() method..
>
>However the query deos not run successfully and returns a null
>resultset..
>
>Could any of you please help us with the construction of the query?
>
>Also is there any way we can know what the final query looks like after
>the ? marks have been replaced?
>
>Thanks
>
>Nitin Kulkarni
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html