-//W3C//DTDHTML4.01Transitional//EN""http://www.w3...
String searchStr="";
if(request.getParameter("keyValue")!=null){
String keyField=request.getParameter("keyField");
String keyValue=new String(request.getParameter("keyValue").getBytes("iso8859-1"),"utf-8");
searchStr="where "+keyField+" like '%"+keyValue+"%'";
}
String driverClass = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String url = "jdbc:sqlserver://localhost:1433;DatabaseName=Center_CB";
String user = "SqlConnect"; String password = "123456";Connection con =null;Statement st=null;
ResultSet rs=null;
try{ Class.forName(driverClass);
con=DriverManager.getConnection(url, user, password);
st=con.createStatement();
}catch(Exception e) { e.printStackTrace(System.err); out.println("网站出错,请与管理员联系"); return;}
%>
关键字
展开
本文介绍如何使用SQL查询技术,通过用户提供的户号和电话号码关键字,在Center_CB数据库中展开搜索。焦点在于前端获取参数后,转化为数据库查询条件进行高效检索。

被折叠的 条评论
为什么被折叠?



