String title = request.getParameter("title");
String content = request.getParameter("content");
String choice1 = request.getParameter("choice1");
String choice2 = request.getParameter("choice2");
String choice3 = request.getParameter("choice3");
String choice4 = request.getParameter("choice4");
String choice5 = request.getParameter("choice5");
String choice6 = request.getParameter("choice6");
String choice7 = request.getParameter("choice7");
String choice8 = request.getParameter("choice8");
String choice9 = request.getParameter("choice9");
String choice_type = request.getParameter("choice_type");
String enddate = request.getParameter("enddate");
String investor = request.getParameter("investor"); invest.title = title;
invest.content = content;
invest.type_id = Integer.parseInt(choice_type);
invest.investor = investor;
invest.enddate = enddate;
invest.totalnum = 0;
invest.status = 1;
invest.havevoted = "Tom";
investmanager.addInvest(invest);
}
%>

解决方案 »

  1.   

    investmanager 是一个类,其中有addInvest(Invest invest)方法
    就是想数据库中添加数据的
      

  2.   

    是完全不能插入啊!数据库结构如下:
    table:invest
    有以下几个列:
    id int
    title  String 
    content  String 
    type_id int
    investor String
    enddate String
    totalnum int
    status int
    havevoted String [允许空]
      

  3.   

    "连接数据库的代码"
    比如:
    driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
       url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=db_jewelry"
       user="sa"
       password="sql"
    等那部分代码
    帖出来
      

  4.   


    out.println(content);
    out.println(choice1);
    .......
    out.println(invest.title );
    .....
    把每个值输出来看看!