insert into question values((select nvl(max(q_id),0)+1 from question),"name")
以下是徐培贡献给我的源代码:
真的很感谢他!!!
package manager;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;
public class m_interAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
m_interActionForm m_interActionForm = (m_interActionForm) form;
String type=m_interActionForm.getType();
String question=m_interActionForm.getQuestion();
String option=m_interActionForm.getOption();
String kind=m_interActionForm.getKind();
try{
type=Tools.isoGb(type);
question=Tools.isoGb(question);
option=Tools.isoGb(option);
kind=Tools.isoGb(kind);
}catch(Exception e)
{
System.out.println("编码转换异常");
}
String sql = "insert into question values((select nvl(max(q_id),0)+1 from question),'" +
type + "','" + question + "','" + option + "','" + kind +"')";
DB db = new DB();
System.out.println("this is sql +++"+sql);
boolean bl=db.update(sql);
if(bl)
return mapping.findForward("m_inter_success");
else
return mapping.findForward("m_inter_error");
}
}
以下是徐培贡献给我的源代码:
真的很感谢他!!!
package manager;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;
public class m_interAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
m_interActionForm m_interActionForm = (m_interActionForm) form;
String type=m_interActionForm.getType();
String question=m_interActionForm.getQuestion();
String option=m_interActionForm.getOption();
String kind=m_interActionForm.getKind();
try{
type=Tools.isoGb(type);
question=Tools.isoGb(question);
option=Tools.isoGb(option);
kind=Tools.isoGb(kind);
}catch(Exception e)
{
System.out.println("编码转换异常");
}
String sql = "insert into question values((select nvl(max(q_id),0)+1 from question),'" +
type + "','" + question + "','" + option + "','" + kind +"')";
DB db = new DB();
System.out.println("this is sql +++"+sql);
boolean bl=db.update(sql);
if(bl)
return mapping.findForward("m_inter_success");
else
return mapping.findForward("m_inter_error");
}
}