一个考试系统,用户最多30人,用哪种方案最节省:
一、每做一题直接用sql语句更新数据库(现在就用这种,但cpu负担很重,时间一长很有可能当机)
二、每做一题调用存储过程更新数据库(比上一种要节省开销吗?)
三、每做一题保存为xml,最后提交数据库

解决方案 »

  1.   

    保存到DataTable里,最后批量提交到数据库里.
      

  2.   

    在关闭程序和提交前DataTable的数据保存在内存中,提交时可以用事务提交。
      

  3.   

    俺做的考试类系统,同时100个用户,每一道题都是直接读数据库,并直接写数据库,没有任何问题!而且用了将近10个session来保存用户数据!!!
    要注意断点续存和异常处理!即每一步都要用cookie之类的东西记下来!以利重新载入
      

  4.   

    case 13
    if not list12.selecteditem is nothing then
            dim conn12 as new oledbconnection("Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=system;Password=manager;Data Source=ks") 
            conn12.open()
            dim answer12=list12.selecteditem.value
            dim sql12="update "& session("ksr") &" set dt='"& answer12 &"' where th='12'"
            dim cmd12 as new oledbcommand(sql12,conn12)
            cmd12.executenonquery()
            conn12.close()
            end ifcase 14
    if not list13.selecteditem is nothing then
            dim conn13 as new oledbconnection("Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=system;Password=manager;Data Source=ks") 
            conn13.open()
            dim answer13=list13.selecteditem.value
            dim sql13="update "& session("ksr") &" set dt='"& answer13 &"' where th='13'"
            dim cmd13 as new oledbcommand(sql13,conn13)
            cmd13.executenonquery()
            conn13.close()
            end if这是做其中的两题的部分代码,发现只要做题时,web层cpu负担开始增加(cpu2.8,2Gddr)配置应该不借了,但数据库服务器(cpu2.4,2Gddr)还可以
      

  5.   

    我想这些都不是根本所在,你用哪种方式都是差不多,谈不上资源的消耗。
    .net在使用大量的session变量的时候就是这个样子,页面显示不正常,不知道高版本的怎么样,我现在用它用伤心了, 服务端控件用多点就有问题,不是撑死内存就是cpu,开发时同样出现,浏览时间长点也出现,你用ASP肯定没有问题!