changehotsearch.java

来自「智能文档检索系统」· Java 代码 · 共 42 行

JAVA
42
字号



package changeHotSearch;

import java.sql.*;
import java.util.*;
import user.*;


public class changeHotSearch 
{
    
    
    public changeHotSearch() 
    {
    }
    public void addTimes(String zuhe_parameterValue)
    {
        DB db_con=new DB();
        Connection conn=db_con.getConnection();
        try
        {
        Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
        Statement stmt2=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
        String hotsql="select ID,did,times from hotsearch where word='"+zuhe_parameterValue+"'";//使用的是未分解的输入内容
        ResultSet hotrs=stmt2.executeQuery(hotsql);
        int times=hotrs.getInt("times");//如果热表里面有相应的词,则次数加一
        int hotID=hotrs.getInt("ID");
        times++;
        hotsql="update hotsearch set times="+times+" where ID="+hotID;
        stmt.executeUpdate(hotsql);
        stmt2.close();
        stmt.close();
        conn.close();
        }
        catch(Exception e){System.out.println("wo");};
    
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?