日期:2014-05-18  浏览次数:20608 次

[求助] - 新手请教
<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   import= "java.sql.* "%>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 号码判断 </title>
</head>
<%
Class.forName( "com.sybase.jdbc.SybDriver ").newInstance();
String   url   = "   jdbc:sybase:Tds:133.40.102.254:5000/info1000 ";
Properties   SysProps   =   System.getProperties();
SysProps.put( "user ", "info1000 ");
SysProps.put( "password ", "suntek ");
Connection   conn=   DriverManager.getConnection(url,SysProps);
String   action   =   request.getParameter( "action ");
String   telNum   =   request.getParameter( "tel_num ");
ResultSet   rs   =null;
if(action==null)action= " ";
if(telNum==null)telNum= " ";
if(action.equals( "seach ")){
Statement   stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String   sql= "select   *   from   remarkphs   where   tel_num   =   ' "+telNum+ " ' ";
String   name= " ";
rs=stmt.executeQuery(sql);
while(rs.next())   {
name=   rs.getString(1);
out.println( "有此号码 ");
}
rs.close();
stmt.close();
conn.close();
}
%>
<body>
<form   name   = "bb "   action= "?action=seach "   method= "post "   >   请输入号码: <input   type= "text "   class= "box "   size=18   name= "tel_num ">    
            <td> <input   type= "submit "   name= "test "   value= "判断号码 "> </td>

</form>
</body>
</html>        


此页实现功能为检索输入号码是否为表内数据
现本程序现可判断输入号码同在表内的数据

急需加入一个判断输入号码不在表内数据的程序
请指教
谢谢


------解决方案--------------------
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 号码判断 </title>
</head>
<%
Class.forName( "com.sybase.jdbc.SybDriver ").newInstance();
String url = " jdbc:sybase:Tds:133.40.102.254:5000/info1000 ";
Properties SysProps = System.getProperties();
SysProps.put( "user ", "info1000 ");
SysProps.put( "password ", "suntek ");
Connection conn= DriverManager.getConnection(url,SysProps);
String action = request.getParameter( "action ");
String telNum = request.getParameter( "tel_num ");
ResultSet rs =null;
if(action==null)action= " ";
if(telNum==null)telNum= " ";
if(a