我不知道那个vote该怎么去定义!
//
try{Connection con=null;
ResultSet rs=null;
String vote=null;
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/vote?user=root&password=111111");
String sql="select * from vote;";
Statement stmt=con.createStatement(sql);
ResultSet rs = stmt.execute(sql);
if(!rs.next()){
sql="insert into vote values(0,0,0,0,0,0,0,0,0,0,0,1)";
vote.update(sql);
}else{
String s1=request.getParameter("d1");
String s2=request.getParameter("d2");
String s3=request.getParameter("d3");
String s4=request.getParameter("d4");
if(s1.equals("a1")){
sql="update vote set a1=a1+1";
vote.update(sql);}
else if(s1.equals("a2"))
{
sql="update vote set a2=a2+1";
vote.update(sql);
}else if(s1.equals("a3"))
{
sql="update vote set a3=a3+1";
vote.update(sql);
}
if(s2.equals("a4")){
sql="update vote set a4=a4+1";
vote.update(sql);}
else if(s2.equals("a5"))
{
sql="update vote set a5=a5+1";
vote.update(sql);
}
if(s3.equals("a6")){
sql="update vote set a6=a6+1";
vote.update(sql);}
else if(s3.equals("a7"))
{
sql="update vote set a7=a7+1";
vote.update(sql);
}else if(s3.equals("a8"))
{
sql="update vote set a8=a8+1";
vote.update(sql);
}
else if(s3.equals("a9"))
{
sql="update vote set a9=a9+1";
vote.update(sql);
}
if(s4.equals("a10"))
{
sql="update vote set a10=a10+1";
vote.update(sql);
}
else if(s4.equals("a11"))
{
sql="update vote set a11=a11+1";
vote.update(sql);
}
sql="update vote set num=num+1";
vote.update(sql);
response.sendRedirect("over.jsp");
}
}