firstleveltitledboperation.java~62~

来自「有发布」· JAVA~62~ 代码 · 共 43 行

JAVA~62~
43
字号
package DB;

import bean.ConnectionBean;
import bean.FirstLevelTitle;
import bean.SecondLevelTitle;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.SQLException;

public class FirstLevelTitleDbOperation {
    public FirstLevelTitleDbOperation() {
    }

    public int instersecond(FirstLevelTitle fTitle) throws SQLException {
         int host = 0;
         Connection con = null;
            ResultSet ret = null;
            PreparedStatement stmt = null;

        try
        {
            ConnectionBean dbcon = ConnectionBean.newInstance();
            con = dbcon.getConnDB();
            stmt = con.prepareStatement("insert into FirstLevelTitle(TitleName,FilePath,Creater,ParentTitle) values(?,?,?,?)");
            stmt.setString(1, fTitle.getTitleName());
            stmt.setString(2, fTitle.getCreater());
            host = stmt.executeUpdate();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
           con.close();
           stmt.close();
        }
        return host;
    }

}

⌨️ 快捷键说明

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