📄 serveditcontent.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package com.wwr.editContent;import com.wwr.commons.DBConnection;import java.sql.CallableStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Types;import java.util.ArrayList;/** * * @author user */public class ServEditContent { private DBConnection dbc; private ResultSet rs; private CallableStatement cstmt; private ArrayList editList; int count = 0; public ArrayList getContentDetails(String contID, String contType){ try{ dbc = new DBConnection(); editList = new ArrayList(); String query = "{call dbo.GetContentDetails(?,?)}"; cstmt = dbc.exe_callable_statement(query); cstmt.setString(1, contID); cstmt.setString(2, contType);// rs = dbc.execQuery("select * from tbl_content_details where content_id = "+contID+" and content_type = '"+contType+"'"); rs = cstmt.executeQuery(); if(rs.next()){ int content_id = rs.getInt("content_id"); String content_type = rs.getString("content_type"); String sub_type = rs.getString("sub_type"); String description = rs.getString("description"); String insert_Date = rs.getString("insert_Date"); String execute_date = rs.getString("execute_date"); String expiry_date = rs.getString("expiry_date"); String status = rs.getString("status"); EditContentDTO ecd = new EditContentDTO(); ecd.setContent_id(content_id); ecd.setContent_type(content_type); ecd.setSub_type(sub_type); ecd.setDescription(description); ecd.setInsert_Date(insert_Date); ecd.setExecute_date(execute_date); ecd.setExpiry_date(expiry_date); ecd.setStatus(status); editList.add(ecd); } }catch(Exception e){ e.printStackTrace(); } return editList; } public int updateContentDetails(String contID, String contType, String desc) throws SQLException{ try{ dbc = new DBConnection();// // String query = "{call dbo.UpdateContentDetails(?,?,?)}";//// cstmt = dbc.exe_callable_statement(query);// cstmt.setString(1, contID);// cstmt.setString(2, contType);// cstmt.setString(3, desc);// cstmt.registerOutParameter(4, Types.NUMERIC); // count = cstmt.executeUpdate(query);// System.out.println("countcountcountcountcount ::: ::: ::: "+count); count = dbc.execUpdate("update tbl_content_details set description= '"+desc+"' where content_id= "+contID+" and content_type= '"+contType+"'"); }catch(Exception e){ e.printStackTrace(); }finally{ if(dbc != null){ dbc.close(); } } return count; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -