Hi all,
I did the code for searching video.
My purpose is the user may enter
Type, Title or Actor, or either any
two of them, or all of them.
The code can work individually, but
after put them together, it only works on
last query which to enter all of them
three. Could anyone give any idea?
Thanks in advance!!
Code:
<%
if( VideoType == "ALL" )
{
if( VideoTitle == "" )
{
if( VideoActor == "" ) {
strSQL = "SELECT ISBN, V_Title, V_Type,
V_Actor, V_Time FROM
Video_Catalog";
}
else {
strSQL = strSELECT + "V_Actor = '" +
VideoActor + "'";
}
}
else
{
if( VideoActor=="" ) {
strSQL = strSELECT + "V_Title = '" +
VideoTitle + "'";
}
else {
strSQL = strSELECT + "V_Title = '" +
VideoTitle + "' AND V_Actor = '" +
VideoActor + "'";
}
}
}
else
{
if( VideoTitle=="")
{
if( VideoActor==""){
strSQL = strSELECT + "V_Type = '" + VideoType
+ "'";
}
else{
strSQL = strSELECT + "V_Type = '" + VideoType
+ "' AND V_Actor = '" + VideoActor
+ "'";
}
}
else
{
if( VideoActor==""){
strSQL = strSELECT + "V_Type = '" + VideoType
+ "' AND V_Title = '" + VideoTitle
+ "'";
}
else {
strSQL = strSELECT + "V_Type = '" + VideoType
+ "' AND V_Title = '" + VideoTitle +
"' AND V_Actor = '" + VideoActor + "'";
}
}
}
%>
<% rs = statement.executeQuery( strSQL ); %>
Jun Wang
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets