How to write statement using LIKE statement in jsp

hi

I am new to jsp. I would like to retrive the data from database using like command. But my query dosen't work well. Can you help me in this topic.

String name = request.getParameter("username");

int i = st.executeQuery("select * from emp where empname LIKE '%name%'");

Plase help me..

Thanking you

sure...

[354 byte] By [sure_2912a] at [2007-11-26 14:33:43]
# 1

Using LIKE :

==========

The following SQL statement will return persons with first names that start with an 'O':

SELECT * FROM Persons

WHERE FirstName LIKE 'O%'

The following SQL statement will return persons with first names that contain the pattern 'la':

SELECT * FROM Persons

WHERE FirstName LIKE '%la%'

Hope this might have helped you

REGARDS,

RaHuL

RahulSharnaa at 2007-7-8 2:29:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

String name = "%" + request.getParameter("username") + "%";

String sql = "select * from emp where empname LIKE '" + name + "'";

int i = st.executeQuery(sql);

tolmanka at 2007-7-8 2:29:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Hi..sir... Thank u very much. I belive you are help me in this case. once again thank you very much.with regardssure...:)-
sure_2912a at 2007-7-8 2:29:37 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...