请版主帮忙!!!
风清扬-3 2002-12-09 04:07:58 不对之处请指正!
Vector v=new Vector();
Vector w=new Vector();
Vector p=new Vector();
try{
sql0="select mctfanswer, shortanswer from questions where classid='"+courseid+"' and type='"+type+"' order by assignid";
stmt0=con.createStatement();
result0=stmt0.executeQuery(sql0);
while(result0.next())
{
String mctf=result0.getString(1);
String shortanswer=result0.getString(2);
Vector rows=new Vector(2,1);
rows.addElement(mctf);
rows.addElement(shortanswer);
v.addElement(rows);
}
result0.close();
stmt0.close();
}catch (SQLException Ex) {
out.println("query questions failed");
}
try{
sql1="select mctfanswer,shortanswer from submittedqs where classid='"+courseid+"' and type='"+type+"' and userid='"+userid+"' order by assignid";
stmt01=con.createStatement();
result01=stmt01.executeQuery(sql1);
while(result01.next())
{
String submctf=result01.getString(1);
String subshort=result01.getString(2);
Vector rows0=new Vector(2,1);
rows0.addElement(submctf);
rows0.addElement(subshort);
w.addElement(rows0);
}
result01.close();
stmt01.close();
}catch (SQLException Ex) {
out.println("query questions failed");
}
try{
sql10="select points from questions where classid='"+courseid+"' and session='"+section+"' and type='"+type+"' order by assignid";
stmt0=con.createStatement();
result0=stmt0.executeQuery(sql0);
while(result0.next())
{
points=result0.getInt(1);
Vector rows1=new Vector(1,1);
rows1.addElement(points);
p.addElement(rows1);
}
result01.close();
stmt01.close();
}catch (SQLException Ex) {
out.println("query questions failed");
}
for(int i=1;i<v.size() ;i++){
if(v.equals(w)){
points=Integer.parseInt(rows1.elementAt(i));
points+=points;
}