java随机抽题系统_在用java做一个在线考试系统,随机抽题遇到了问题,我写了一个随机抽题的方法,不知道在asp按钮中怎么用...

你们看看方法对不对?publicListsuiji(intshitiId,inttimuId,inttimunanyidu,StringtimuLeixing){Stringsql="fromTTimuwheretimunanyidu=?UNIONallselecttop3*fromTTimuwheretimuLeix...

你们看看方法对不对?

public List suiji(int shitiId,int timuId,int timunanyidu,String timuLeixing)

{

String sql="from TTimu where timunanyidu=? UNION all select top 3* from TTimu where timuLeixing='danxuan' order by newid()UNION all select top 2* from TTimu where timuLeixing='yuedu' order by newid()UNION all select top 1* from TTimu where timuLeixing='sheji' order by newid()UNION all select top 2* from TTimu where timuLeixing='tiankong' order by newid()";

Object con[]={shitiId,timuId};

List list=timuShitiDAO.getHibernateTemplate().find(sql,con);

TTimuShiti timuShiti=new TTimuShiti();

timuShiti.setShitiId(shitiId);

timuShiti.setTimuId(timuId);

timuShitiDAO.save(timuShiti);

return list;

}

我把方法写在了loginServer.java中,想用按钮点击一下对数据库t_timu表中的试题进行随机抽题,表中有timu_id,timu_nanyidu(难易度),timu_Leixing(题目类型)等等字段,首先要确定难易度,然后再从相同难易度中随机抽出单选题5个,阅读题2个,设计题1个,填空题3个。

现在不知道方法对不对,还有按钮所在asp代码怎么写

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值