rs.recordcount是返回什么值?

ap3344 2003-08-20 04:05:11
rs.recordcount是返回什么值?
为什么我总是返回-1
谢谢
...全文
376 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
dgm8 2003-08-27
  • 打赏
  • 举报
回复
adOpenForwardOnly为光标的缺省值,你要使用ado常量,必须先引用.

如包含adovbs.inc文件

或者引用类型库UUID:
<!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"-->

或者引用类型库文件路径
<!-- METADATA TYPE="typelib" FILE="c:\program files\common files\system\ado\msado15.dll"-->
dgm8 2003-08-27
  • 打赏
  • 举报
回复
RecordCount在光标为adOpenForwardOnly是不能使用,调用就返回-1
萝卜波 2003-08-27
  • 打赏
  • 举报
回复
我以前也有出现这个问题
可以 改游标的类型

然后加上

if not rs.eof then rs.movelast
if not rs.bof then rs.movefirst

问题解决
zhangking 2003-08-27
  • 打赏
  • 举报
回复
为什么我的记录集的 RecordCount 值总是返回 -1 ?

A:你应当使用这种模式来打开存取数据库的记录集:
rec.open strSQL,conn,1,1
其中的 strSQL 是操作数据库的 SQL 语句; conn 是联接数据库的 Connection 变量。
zhangking 2003-08-27
  • 打赏
  • 举报
回复
返回查询结果记录集的记录数
zenggao 2003-08-27
  • 打赏
  • 举报
回复
返回你查询结果的记录数
roam831 2003-08-27
  • 打赏
  • 举报
回复
不明白什么原因,请高手能详细讲解一下con后面的1,3,1等的具体用法吗?

--------------------------------------------------------------------------

http://expert.csdn.net/Expert/topic/2099/2099694.xml?temp=7.879275E-02
eliphe 2003-08-27
  • 打赏
  • 举报
回复
返回查询到的记录个数(总数)

set rs=server.createobject("adodb.recordset")
rs.open sql,con,3,1

就不会返回-1,除非查找不到记录,即没有符合要求的记录。
82yuxuan 2003-08-20
  • 打赏
  • 举报
回复
表内一共有多少条数据
zhxhjj 2003-08-20
  • 打赏
  • 举报
回复
要在rs.open后加游标,rs.recordcount才能返回记录个数,否则一直为-1

kakau 2003-08-20
  • 打赏
  • 举报
回复
游标
zifan1980 2003-08-20
  • 打赏
  • 举报
回复
我刚才也遇到了你这样的问题,用的是sql数据库吧,在access下没问题
sql下面这样写rs.open sql,con,3,1可以返回正确的rs.recordcount
否则这样写的rs.open sql,con 或者rs.open sql,con,1,3,1都只能返回-1
不明白什么原因,请高手能详细讲解一下con后面的1,3,1等的具体用法吗?
jiejifeng 2003-08-20
  • 打赏
  • 举报
回复
记录数

要用 rs.open sql,con,3,1 这种形式, rs.recordcount才正确
ap3344 2003-08-20
  • 打赏
  • 举报
回复
你们说的问题我都没有,因为查询出的结果都是正确的
就是rs.recordcount的值是-1
chinesun 2003-08-20
  • 打赏
  • 举报
回复
rs.recordcount是返回查询到的记录总数
你用
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1//conn是你的connection
这样要么就是返回0,要么返回>0的整数
coffee_cn 2003-08-20
  • 打赏
  • 举报
回复

set rs=conn.execute(sql)


set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
xmsunny 2003-08-20
  • 打赏
  • 举报
回复
应该是记录条数吧,你是不是库没打开呀
diya 2003-08-20
  • 打赏
  • 举报
回复
返回查询到的记录个数(总数)

rs.open sql,con,3,1

就不会返回-1,除非查找不到记录,即没有符合要求的记录。
diya 2003-08-20
  • 打赏
  • 举报
回复
返回查询到的记录个数(总数)

rs.open sql,con,3,1

就不会返回-1,除非查找不到记录,即没有符合要求的记录。
1. ASP与Access数据库连接: <% dim conn,mdbfile mdbfile=server.mappath("数据库名称.mdb") set conn=server.createobject("adodb.connection") conn.open "driver={microsoft access driver (*.mdb)};uid=admin;pwd=数据库密码;dbq="&mdbfile %> 2. ASP与SQL数据库连接: <% dim conn set conn=server.createobject("ADODB.connection") con.open "PROVIDER=SQLOLEDB;DATA SOURCE=SQL服务器名称或IP地址;UID=sa;PWD=数据库密码;DATABASE=数据库名称 %> 建立记录集对象: set rs=server.createobject("adodb.recordset") rs.open SQL语句,conn,3,2 3. SQL常用命令使用方法: (1) 数据记录筛选: sql="select * from 数据表 where 字段名=字段 order by 字段名 " sql="select * from 数据表 where 字段名 like ‘%字段%‘ order by 字段名 " sql="select top 10 * from 数据表 where 字段名 order by 字段名 " sql="select * from 数据表 where 字段名 in (‘1‘,‘2‘,‘3‘)" sql="select * from 数据表 where 字段名 between 1 and 2" (2) 更新数据记录: sql="update 数据表 set 字段名=字段 where 条件表达式" sql="update 数据表 set 字段1=1,字段2=2 …… 字段n=n where 条件表达式" (3) 删除数据记录: sql="delete from 数据表 where 条件表达式" sql="delete from 数据表" (将数据表所有记录删除) (4) 添加数据记录: sql="insert into 数据表 (字段1,字段2,字段3 …) valuess (1,2,3 …)" sql="insert into 目标数据表 select * from 源数据表" (把源数据表的记录添加到目标数据表) (5) 数据记录统计函数: AVG(字段名) 得出一个表格栏平均 COUNT(*|字段名) 对数据行数的统计或对某一栏有的数据行数统计 MAX(字段名) 取得一个表格栏最大的 MIN(字段名) 取得一个表格栏最小的 SUM(字段名) 把数据栏的相加 引用以上函数的方法: sql="select sum(字段名) as 别名 from 数据表 where 条件表达式" set rs=conn.excute(sql) 用 rs("别名") 获取统的计,其它函数运用同上。 (5) 数据表的建立和删除: CREATE TABLE 数据表名称(字段1 类型1(长度),字段2 类型2(长度) …… ) 例:CREATE TABLE tab01(name varchar(50),datetime default now()) DROP TABLE 数据表名称 (永久性删除一个数据表) (6) 记录集对象的方法: rs.movenext 将记录指针从当前的位置向下移一行 rs.moveprevious 将记录指针从当前的位置向上移一行 rs.movefirst 将记录指针移到数据表第一行 rs.movelast 将记录指针移到数据表最后一行 rs.absoluteposition=N 将记录指针移到数据表第N行 rs.absolutepage=N 将记录指针移到第N页的第一行 rs.pagesize=N 设置每页为N条记录 rs.pagecount 根据 pagesize 的设置返回总页数 rs.recordcount 返回记录总数 rs.bof 返回记录指针是否超出数据表首端,true表示是,false为否 rs.eof 返回记录指针是否超出数据表末端,true表示是,false为否 rs.delete 删除当前记录,但记录指针不会向下移动 rs.addnew 添加记录到数据表末端 rs.update 更新数据表记录 判断所填数据是数字型 if not isNumeric(request("字段名称")) then response.write "不是数字" else response.write "数字" end if
连接数据库代码实例 1,连接数据库代码 文件名称 conn.asp 所有访问数据库的文件都调用此文件 <% db=\"data/data.mdb\" \'数据库存放目录 on error resume next set conn=server.createobject(\"adodb.connection\") conn.open \"driver={microsoft access driver (*.mdb)};dbq=\"&server.mappath(db) if err then err.clear set conn = Nothing response.write \"数据库连接出错,请检查conn.asp中的连接字符串。\" response.end end if function CloseDB Conn.Close set Conn=Nothing End Function %> <% dim badword badword=\"\'|and|select|update|chr|delete|%20from|;|insert|mid|master.|set|chr(37)|=\" if request.QueryString<>\"\" then chk=split(badword,\"|\") for each query_name in request.querystring for i=0 to ubound(chk) if instr(lcase(request.querystring(query_name)),chk(i))<>0 then response.write \"<script language=javascript>alert(\'传参错误!参数 \"&query_name&\" 的中包含非法字符串!\\n\\n\');location=\'\"&request.ServerVariables(\"HTTP_REFERER\")&\"\'\" response.end end if next next end if %> ---------------------------------------------- 2。增加纪录 <% if request(\"action\")=\"add\" then name=request.form(\"name\") content=request.form(\"content\") set rs=server.createobject(\"adodb.recordset\") sql=\"select * from biao\" rs.open sql,conn,3,2 rs.addnew rs(\"name\")=name if content<>\"\" then rs(\"content\")=content else rs(\"content\")=null end if rs(\"date\")=date() rs.update rs.close set rs=nothing response.write \"<script language=javascript>alert(\'添加成功!\');location.href(\'index.asp\'); -------------------------------------- 3.显示记录 <% set rs=server.createobject(\"adodb.recordset\") sql=\"select * from biao order by id desc\" \'sql=\"select top 10 * from biao order by id desc\" rs.open sql,conn,1,1 rs.pagesize=15 \'-------设置每页显示的记录数 dim page page=request(\"page\") if page<>\"\" and IsNumeric(page) then page=clng(page) else page=1 end if n=rs.pagecount if page>n then page=clng(n) end if if rs.eof then response.write\"暂没有信息!\" \'response.end else rs.absolutepage=page end if i=0 do while not rs.eof and i<rs.pagesize \'do while not rs.eof %> --------如果是每行显示n个纪录开始---------------------------- <% do while not rs.eof and i<rs.pagesize \'do while not rs.eof if i mod 5=0 then \'--------设置每行显示的个数 response.write \"\" end if %> --------如果是每行显示n个纪录结束----------------------------- <%=rs(\"id\")%> <% rs.movenext i=i+1 loop %> <% response.write(\"共\"&rs.recordcount&\"条信息   \") if page<>1 then response.write(\"首页 \") else response.write(\"首页 \") end if if page>1 then response.write(\"上一页 \") else response.write(\"上一页 \") end if if page下一页 \") else response.write(\"下一页 \") end if if page<>n then response.write(\"尾页 \") else response.write(\"尾页 \") end if response.write(\"   当前页:\"&page&\"/\"&n&\"\") %> 转到: ------search.asp--------------- <% if request("keyword")<>"" and request("select")<>"" then sql="select * from biao where "&request("select")&" like '%"&request("keyword")&"%'" elseif request("keyword")<>"" and request("select")="all" then sql="select * from biao where name like '%"&request("keyword")&"%' or id like '%"&request("keyword")&"%' or content like '%"&request("keyword")&"%'" else response.redirect("index.asp") end if set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 rs.pagesize=15 '-------设置每页显示的记录数 dim page page=request("page") if page<>"" and IsNumeric(page) then page=clng(page) else page=1 end if n=rs.pagecount if page>n then page=clng(n) end if if rs.eof then response.write"查询的信息不存在或者已经删除!" 'response.end else rs.absolutepage=page end if i=0 do while not rs.eof and i<rs.pagesize 'do while not rs.eof %> <%=rs("id")%> <% rs.movenext i=i+1 loop %> ----------------------------------------- 6.有分类的纪录代码 ---------------显示分类开始--------------------------------- <% set rs=server.createobject("adodb.recordset") sql="select all * from class order by id desc" rs.open sql,conn,1,1 do while not rs.eof %> "><%=rs("classname")%> <% rs.movenext i=i+1 loop %> ---------------显示分类结束-------------------------- -------------显示现在所在分类开始------------------- <% set rs=server.createobject("adodb.recordset") sql="select top 1 * from class where classname='"&request("classname")&"'" rs.open sql,conn,1,1 do while not rs.eof %> <%=rs("classname")%> <% rs.movenext i=i+1 loop %> -----------显示现在所在分类结束---------------------- -----------显示此分类的纪录开始------------ <% set rs=server.createobject("adodb.recordset") sql="select * from biao where fenlei='"&request("classname")&"'" rs.open sql,conn,1,1 rs.pagesize=10 '-------设置每页显示的记录数 dim page page=request("page") if page<>"" and IsNumeric(page) then page=clng(page) else page=1 end if n=rs.pagecount if page>n then page=clng(n) end if if rs.bof or rs.eof then response.write"暂没有任何数据!" 'response.end else rs.absolutepage=page end if i=0 do while not rs.eof and i<rs.pagesize %> <%=rs("id")%> <% rs.movenext i=i+1 loop %> --------------显示此分类的纪录结束---------------- ---------删除所在分类纪录开始------------ <% if request("classname")<>"" then%> " title="删除所有本类信息?" onClick="{if (confirm('您确定要删除所有信息吗?')){return true;}return false;}">清空所有本类信息 <%end if%> if request("action")="del_fenlei" then classname=request("classname") conn.execute("delete * from biao where fenlei='"&classname&"'") CloseDB response.write"<script language='javascript'>alert('删除本类成功!');location.href('?action=manage'); upsoftpic.asp
upfile.asp <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <%Server.ScriptTimeout=999%> <% if request("action")="upsoftpic" then set upload=new upload_5xsoft set file=upload.file("softpic") fileExt=lcase(right(file.filename,4)) if fileEXT<>".jpg" and fileEXT<>".gif" and fileEXT<>".rar" then '---设置上传类型 ++++fileEXT<>".***"++++++++ response.write"<script>alert('格式不对,请重新上传!');location='"&request.ServerVariables("HTTP_REFERER")&"'0 then formPath="upfile/softpic" '-------上传路径 'formPath="../upfile/softpic" if right(formPath,1)<>"/" then formPath=formPath&"/" end if vfname = filename(now()) fname = vfname & "." & GetExtendName(file.FileName) file.SaveAs Server.mappath(formPath&fname) ''保存文件 %> <script> parent.form.picurl.value+='upfile/softpic/<%=fname%>' //-上传路径 //parent.frmadd.dreamcontent.value+='[img]upload/<%=ufp%>[/img]' location.replace('Upsoftpic.asp') //---返回文件 upload.asp 删除文件和记录 <% if request("action")="manage" then call manage() end if if request("action")="edit" then id=request("id") set rs=server.createobject("adodb.recordset") sql="select * from biao where id="&id&"" rs.open sql,conn,1,1 call edit() end if if request("action")="del" then set rs=server.createobject("adodb.recordset") sql="select * from biao where id="&request("id")&"" rs.open sql,conn,3,2 set fileobj=server.createobject("scripting.filesystemobject") if fileobj.FileExists(server.mappath(""&rs("picurl"))) then fileobj.DeleteFile server.mappath(""&rs("picurl")) end if rs.delete conn.close response.write"<script language='javascript'>alert('删除成功!');location.href('?action=manage');rs=server.createobject("adodb.recordset") sql="select * from biao" rs.open sql,conn,3,2 set fileobj=server.createobject("scripting.filesystemobject") i=0 do while not(rs.bof or rs.eof) and i<rs.recordcount if fileobj.FileExists(server.mappath(""&rs("picurl"))) then'-----------("../" &rs("picurl"))) then fileobj.DeleteFile server.mappath(""&rs("picurl")) end if rs.movenext i=i+1 loop conn.execute("delete * from biao") conn.close response.write"<script language='javascript'>alert('所有已成功删除!');location.href('?action=manage');rs=server.createobject("adodb.recordset") sql="select * from biao where id="&request("id")&"" rs.open sql,conn,3,2 rs("name")=name rs("content")=content rs("picurl")=picurl rs("hits")=hits rs.update conn.close set rs=nothing response.write "<script language=javascript>alert('编辑成功!');location.href('?id="&request("id")&"&action=edit'); 删除文件 &struploadfiles=<%=rs("picurl")%>&action=delsoftpic" onClick="{if (confirm('您确定要删除这个吗?')){return true;}return false;}">删除 -------------------------------- --*delfile.asp内容*--- <%if request("action")="delsoftpic" then picurl=request.form("picurl") set rs=server.createobject("adodb.recordset") sql="select * from biao where id="&request("id")&"" rs.open sql,conn,3,2 rs("picurl")=null struploadfiles=trim(request.querystring("struploadfiles")) action=trim(request.querystring("action")) dim fso,arruploadfiles,i set fso = createobject("scripting.filesystemobject") fso.deletefile(server.mappath("" & struploadfiles)) set fso = nothing rs.update conn.close set rs=nothing response.write"<script language='javascript'>alert('删除成功!');location.href('edit.asp?id="&request("id")&"&action=edit'); [返回] 8。有关ubb ----------ubbcode.asp-------------- <% const ImagePath="images/emot/" function UBBCode(strContent) strContent= FilterJS(strContent) dim re dim po,ii dim reContent Set re=new RegExp re.IgnoreCase =true re.Global=True po=0 ii=0 re.Pattern="[UPLOAD=(gif|jpg|jpeg|bmp|png)](.[^[]*)(gif|jpg|jpeg|bmp)[/UPLOAD]" strContent=re.replace(strContent,"
此主题相关图片如下:
转动滚轮可缩放图片") re.Pattern="[IMG](http|https|ftp)://(.[^[]*)[/IMG]" strContent=re.replace(strContent,"转动滚轮可缩放图片;按此在新窗口浏览图片") re.Pattern="[DIR=*([0-9]*),*([0-9]*)](.[^[]*)[/DIR]" strContent=re.Replace(strContent,"rsion=7,0,2,0 width=$1 height=$2>") re.Pattern="[QT=*([0-9]*),*([0-9]*)](.[^[]*)[/QT]" strContent=re.Replace(strContent,"") re.Pattern="[MP=*([0-9]*),*([0-9]*)](.[^[]*)[/MP]" strContent=re.Replace(strContent,"rsion=5,1,52,701 flename=mp src=$3 width=$1 height=$2>") re.Pattern="[RM=*([0-9]*),*([0-9]*)](.[^[]*)[/RM]" strContent=re.Replace(strContent,"
") re.Pattern="([FLASH])(.[^[]*)([/FLASH])" strContent= re.Replace(strContent,"点击开新窗口欣赏该FLASH动画![全屏欣赏]
rsion=5,0,0,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=500 height=400>$2") re.Pattern="([FLASH=*([0-9]*),*([0-9]*)])(.[^[]*)([/FLASH])" strContent= re.Replace(strContent,"点击开新窗口欣赏该FLASH动画![全屏欣赏]
rsion=5,0,0,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=$2 height=$3>$4") re.Pattern="([URL])(.[^[]*)([/URL])" strContent= re.Replace(strContent,"$2") re.Pattern="([URL=(.[^[]*)])(.[^[]*)([/URL])" strContent= re.Replace(strContent,"$3") re.Pattern="([EMAIL])(S+@.[^[]*)([/EMAIL])" strContent= re.Replace(strContent,"$2") re.Pattern="([EMAIL=(S+@.[^[]*)])(.[^[]*)([/EMAIL])" strContent= re.Replace(strContent,"$3") '自动识别网址 're.Pattern = "^((http|https|ftp|rtsp|mms):(//|\\)[A-Za-z0-9./=?%-&_~`@':+!]+)" 'strContent = re.Replace(strContent,"$1") 're.Pattern = "((http|https|ftp|rtsp|mms):(//|\\)[A-Za-z0-9./=?%-&_~`@':+!]+)$" 'strContent = re.Replace(strContent,"$1") 're.Pattern = "([^>=""])((http|https|ftp|rtsp|mms):(//|\\)[A-Za-z0-9./=?%-&_~`@':+!]+)" 'strContent = re.Replace(strContent,"$1$2") '自动识别www等开头的网址 're.Pattern = "([^(http://|http:\)])((www|cn)[.](w)+[.]{1,}(net|com|cn|org|cc)(((/[~]*|\[~]*)(w)+)|[.](w)+)*(((([?](w)+){1}[=]*))*((w)+){1}([&](w)+[=](w)+)*)*)" 'strContent = re.Replace(strContent,"$2") '自动识别Email地址,如打开本功能在浏览内容很多的帖子会引起服务器停顿 're.Pattern = "([^(=)])((w)+[@]{1}((w)+[.]){1,3}(w)+)" 'strContent = re.Replace(strContent,"$2") re.Pattern="[em(.[^[]*)]" strContent=re.Replace(strContent,"") re.Pattern="[HTML](.[^[]*)[/HTML]" strContent=re.Replace(strContent,"
以下内容为程序代码:
$1
") re.Pattern="[code](.[^[]*)[/code]" strContent=re.Replace(strContent,"
以下内容为程序代码:
$1
") re.Pattern="[color=(.[^[]*)](.[^[]*)[/color]" strContent=re.Replace(strContent,"$2") re.Pattern="[face=(.[^[]*)](.[^[]*)[/face]" strContent=re.Replace(strContent,"$2") re.Pattern="[align=(center|left|right)](.*)[/align]" strContent=re.Replace(strContent,"
$2
") re.Pattern="[QUOTE](.*)[/QUOTE]" strContent=re.Replace(strContent,"
$1

") re.Pattern="[fly](.*)[/fly]" strContent=re.Replace(strContent,"$1") re.Pattern="[move](.*)[/move]" strContent=re.Replace(strContent,"$1") re.Pattern="[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)](.[^[]*)[/GLOW]" strContent=re.Replace(strContent,"$4
") re.Pattern="[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)](.[^[]*)[/SHADOW]" strContent=re.Replace(strContent,"$4
") re.Pattern="[i](.[^[]*)[/i]" strContent=re.Replace(strContent,"$1") re.Pattern="[u](.[^[]*)([/u])" strContent=re.Replace(strContent,"$1") re.Pattern="[b](.[^[]*)([/b])" strContent=re.Replace(strContent,"$1") re.Pattern="[size=([1-4])](.[^[]*)[/size]" strContent=re.Replace(strContent,"$2") strContent=replace(strContent,"","") set re=Nothing UBBCode=strContent end function Function FilterJS(v) if not isnull(v) then dim t dim re dim reContent Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(javascript)" t=re.Replace(v,"javascript") re.Pattern="(jscript:)" t=re.Replace(t,"jscript:") re.Pattern="(js:)" t=re.Replace(t,"js:") 're.Pattern="(value)" 't=re.Replace(t,"value") re.Pattern="(about:)" t=re.Replace(t,"about:") re.Pattern="(file:)" t=re.Replace(t,"file:") re.Pattern="(document.cookie)" t=re.Replace(t,"documents.cookie") re.Pattern="(vbscript:)" t=re.Replace(t,"vbscript:") re.Pattern="(vbs:)" t=re.Replace(t,"vbs:") re.Pattern="(on(mouse|exit|error|click|key))" t=re.Replace(t,"on$2") 're.Pattern="(&#)" 't=re.Replace(t,"&#") FilterJS=t set re=nothing end if End Function function HTMLEncode(fString) if not isnull(fString) then fString = replace(fString, ">", ">") fString = replace(fString, "<", "<") fString = Replace(fString, CHR(32), " ") fString = Replace(fString, CHR(9), " ") fString = Replace(fString, CHR(34), """) fString = Replace(fString, CHR(39), "'") fString = Replace(fString, CHR(13), "") fString = Replace(fString, CHR(10) & CHR(10), "

") fString = Replace(fString, CHR(10), "
") HTMLEncode = fString end if end function function nohtml(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(<.[^<]*>)" str=re.replace(str," ") re.Pattern="()" str=re.replace(str," ") nohtml=str set re=nothing end function function cutStr(str,strlen) dim l,t,c l=len(str) t=0 for i=1 to l c=Abs(Asc(Mid(str,i,1))) if c>255 then t=t+2 else t=t+1 end if if t>=strlen then cutStr=left(str,i)&".." exit for else cutStr=str end if next cutStr=replace(cutStr,chr(10),"") end function %> '----------ubbcode.asp结束----------------------------- <%=left(rs("name"),6)%> <%=ubbcode(rs("content"))%> <%=Server.HTMLEncode(rs("content"))%> ----------------------字符截取开始------------------------------- <% if len(rs("name"))>10 then response.write "rs("id")&" title='文章标题:"&rs("name")&_ vbcrlf&"阅读次数:"&rs("hits")&vbcrlf&"发表时间:"&rs("date")&"'>"&left(rs("name"),10)&".." else response.write "rs("id")&" title='文章标题:"&rs("name")&_ vbcrlf&"阅读次数:"&rs("hits")&vbcrlf&"发表时间:"&rs("date")&"'>"&rs("name")&"" end if %> ----------------------字符截取结束--------------------------------- 9。有关后台登陆 chk.asp <% if session("admin")="" then response.redirect"index.asp" end if %> md5.asp <% Private Const BITS_TO_A_BYTE = 8 Private Const BYTES_TO_A_WORD = 4 Private Const BITS_TO_A_WORD = 32 Private m_lOnBits(30) Private m_l2Power(30) Private Function LShift(lValue, iShiftBits) If iShiftBits = 0 Then LShift = lValue Exit Function ElseIf iShiftBits = 31 Then If lValue And 1 Then LShift = &H80000000 Else LShift = 0 End If Exit Function ElseIf iShiftBits < 0 Or iShiftBits > 31 Then Err.Raise 6 End If If (lValue And m_l2Power(31 - iShiftBits)) Then LShift = ((lValue And m_lOnBits(31 - (iShiftBits + 1))) * m_l2Power(iShiftBits)) Or &H80000000 Else LShift = ((lValue And m_lOnBits(31 - iShiftBits)) * m_l2Power(iShiftBits)) End If End Function Private Function RShift(lValue, iShiftBits) If iShiftBits = 0 Then RShift = lValue Exit Function ElseIf iShiftBits = 31 Then If lValue And &H80000000 Then RShift = 1 Else RShift = 0 End If Exit Function ElseIf iShiftBits < 0 Or iShiftBits > 31 Then Err.Raise 6 End If RShift = (lValue And &H7FFFFFFE) m_l2Power(iShiftBits) If (lValue And &H80000000) Then RShift = (RShift Or (&H40000000 m_l2Power(iShiftBits - 1))) End If End Function Private Function RotateLeft(lValue, iShiftBits) RotateLeft = LShift(lValue, iShiftBits) Or RShift(lValue, (32 - iShiftBits)) End Function Private Function AddUnsigned(lX, lY) Dim lX4 Dim lY4 Dim lX8 Dim lY8 Dim lResult lX8 = lX And &H80000000 lY8 = lY And &H80000000 lX4 = lX And &H40000000 lY4 = lY And &H40000000 lResult = (lX And &H3FFFFFFF) + (lY And &H3FFFFFFF) If lX4 And lY4 Then lResult = lResult Xor &H80000000 Xor lX8 Xor lY8 ElseIf lX4 Or lY4 Then If lResult And &H40000000 Then lResult = lResult Xor &HC0000000 Xor lX8 Xor lY8 Else lResult = lResult Xor &H40000000 Xor lX8 Xor lY8 End If Else lResult = lResult Xor lX8 Xor lY8 End If AddUnsigned = lResult End Function Private Function md5_F(x, y, z) md5_F = (x And y) Or ((Not x) And z) End Function Private Function md5_G(x, y, z) md5_G = (x And z) Or (y And (Not z)) End Function Private Function md5_H(x, y, z) md5_H = (x Xor y Xor z) End Function Private Function md5_I(x, y, z) md5_I = (y Xor (x Or (Not z))) End Function Private Sub md5_FF(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_F(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) End Sub Private Sub md5_GG(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_G(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) End Sub Private Sub md5_HH(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_H(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) End Sub Private Sub md5_II(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_I(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) End Sub Private Function ConvertToWordArray(sMessage) Dim lMessageLength Dim lNumberOfWords Dim lWordArray() Dim lBytePosition Dim lByteCount Dim lWordCount Const MODULUS_BITS = 512 Const CONGRUENT_BITS = 448 lMessageLength = Len(sMessage) lNumberOfWords = (((lMessageLength + ((MODULUS_BITS - CONGRUENT_BITS) BITS_TO_A_BYTE)) (MODULUS_BITS BITS_TO_A_BYTE)) + 1) * (MODULUS_BITS BITS_TO_A_WORD) ReDim lWordArray(lNumberOfWords - 1) lBytePosition = 0 lByteCount = 0 Do Until lByteCount >= lMessageLength lWordCount = lByteCount BYTES_TO_A_WORD lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(Asc(Mid(sMessage, lByteCount + 1, 1)), lBytePosition) lByteCount = lByteCount + 1 Loop lWordCount = lByteCount BYTES_TO_A_WORD lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(&H80, lBytePosition) lWordArray(lNumberOfWords - 2) = LShift(lMessageLength, 3) lWordArray(lNumberOfWords - 1) = RShift(lMessageLength, 29) ConvertToWordArray = lWordArray End Function Private Function WordToHex(lValue) Dim lByte Dim lCount For lCount = 0 To 3 lByte = RShift(lValue, lCount * BITS_TO_A_BYTE) And m_lOnBits(BITS_TO_A_BYTE - 1) WordToHex = WordToHex & Right("0" & Hex(lByte), 2) Next End Function Public Function MD5(sMessage) m_lOnBits(0) = CLng(1) m_lOnBits(1) = CLng(3) m_lOnBits(2) = CLng(7) m_lOnBits(3) = CLng(15) m_lOnBits(4) = CLng(31) m_lOnBits(5) = CLng(63) m_lOnBits(6) = CLng(127) m_lOnBits(7) = CLng(255) m_lOnBits(8) = CLng(511) m_lOnBits(9) = CLng(1023) m_lOnBits(10) = CLng(2047) m_lOnBits(11) = CLng(4095) m_lOnBits(12) = CLng(8191) m_lOnBits(13) = CLng(16383) m_lOnBits(14) = CLng(32767) m_lOnBits(15) = CLng(65535) m_lOnBits(16) = CLng(131071) m_lOnBits(17) = CLng(262143) m_lOnBits(18) = CLng(524287) m_lOnBits(19) = CLng(1048575) m_lOnBits(20) = CLng(2097151) m_lOnBits(21) = CLng(4194303) m_lOnBits(22) = CLng(8388607) m_lOnBits(23) = CLng(16777215) m_lOnBits(24) = CLng(33554431) m_lOnBits(25) = CLng(67108863) m_lOnBits(26) = CLng(134217727) m_lOnBits(27) = CLng(268435455) m_lOnBits(28) = CLng(536870911) m_lOnBits(29) = CLng(1073741823) m_lOnBits(30) = CLng(2147483647) m_l2Power(0) = CLng(1) m_l2Power(1) = CLng(2) m_l2Power(2) = CLng(4) m_l2Power(3) = CLng(8) m_l2Power(4) = CLng(16) m_l2Power(5) = CLng(32) m_l2Power(6) = CLng(64) m_l2Power(7) = CLng(128) m_l2Power(8) = CLng(256) m_l2Power(9) = CLng(512) m_l2Power(10) = CLng(1024) m_l2Power(11) = CLng(2048) m_l2Power(12) = CLng(4096) m_l2Power(13) = CLng(8192) m_l2Power(14) = CLng(16384) m_l2Power(15) = CLng(32768) m_l2Power(16) = CLng(65536) m_l2Power(17) = CLng(131072) m_l2Power(18) = CLng(262144) m_l2Power(19) = CLng(524288) m_l2Power(20) = CLng(1048576) m_l2Power(21) = CLng(2097152) m_l2Power(22) = CLng(4194304) m_l2Power(23) = CLng(8388608) m_l2Power(24) = CLng(16777216) m_l2Power(25) = CLng(33554432) m_l2Power(26) = CLng(67108864) m_l2Power(27) = CLng(134217728) m_l2Power(28) = CLng(268435456) m_l2Power(29) = CLng(536870912) m_l2Power(30) = CLng(1073741824) Dim x Dim k Dim AA Dim BB Dim CC Dim DD Dim a Dim b Dim c Dim d Const S11 = 7 Const S12 = 12 Const S13 = 17 Const S14 = 22 Const S21 = 5 Const S22 = 9 Const S23 = 14 Const S24 = 20 Const S31 = 4 Const S32 = 11 Const S33 = 16 Const S34 = 23 Const S41 = 6 Const S42 = 10 Const S43 = 15 Const S44 = 21 x = ConvertToWordArray(sMessage) a = &H67452301 b = &HEFCDAB89 c = &H98BADCFE d = &H10325476 For k = 0 To UBound(x) Step 16 AA = a BB = b CC = c DD = d md5_FF a, b, c, d, x(k + 0), S11, &HD76AA478 md5_FF d, a, b, c, x(k + 1), S12, &HE8C7B756 md5_FF c, d, a, b, x(k + 2), S13, &H242070DB md5_FF b, c, d, a, x(k + 3), S14, &HC1BDCEEE md5_FF a, b, c, d, x(k + 4), S11, &HF57C0FAF md5_FF d, a, b, c, x(k + 5), S12, &H4787C62A md5_FF c, d, a, b, x(k + 6), S13, &HA8304613 md5_FF b, c, d, a, x(k + 7), S14, &HFD469501 md5_FF a, b, c, d, x(k + 8), S11, &H698098D8 md5_FF d, a, b, c, x(k + 9), S12, &H8B44F7AF md5_FF c, d, a, b, x(k + 10), S13, &HFFFF5BB1 md5_FF b, c, d, a, x(k + 11), S14, &H895CD7BE md5_FF a, b, c, d, x(k + 12), S11, &H6B901122 md5_FF d, a, b, c, x(k + 13), S12, &HFD987193 md5_FF c, d, a, b, x(k + 14), S13, &HA679438E md5_FF b, c, d, a, x(k + 15), S14, &H49B40821 md5_GG a, b, c, d, x(k + 1), S21, &HF61E2562 md5_GG d, a, b, c, x(k + 6), S22, &HC040B340 md5_GG c, d, a, b, x(k + 11), S23, &H265E5A51 md5_GG b, c, d, a, x(k + 0), S24, &HE9B6C7AA md5_GG a, b, c, d, x(k + 5), S21, &HD62F105D md5_GG d, a, b, c, x(k + 10), S22, &H2441453 md5_GG c, d, a, b, x(k + 15), S23, &HD8A1E681 md5_GG b, c, d, a, x(k + 4), S24, &HE7D3FBC8 md5_GG a, b, c, d, x(k + 9), S21, &H21E1CDE6 md5_GG d, a, b, c, x(k + 14), S22, &HC33707D6 md5_GG c, d, a, b, x(k + 3), S23, &HF4D50D87 md5_GG b, c, d, a, x(k + 8), S24, &H455A14ED md5_GG a, b, c, d, x(k + 13), S21, &HA9E3E905 md5_GG d, a, b, c, x(k + 2), S22, &HFCEFA3F8 md5_GG c, d, a, b, x(k + 7), S23, &H676F02D9 md5_GG b, c, d, a, x(k + 12), S24, &H8D2A4C8A md5_HH a, b, c, d, x(k + 5), S31, &HFFFA3942 md5_HH d, a, b, c, x(k + 8), S32, &H8771F681 md5_HH c, d, a, b, x(k + 11), S33, &H6D9D6122 md5_HH b, c, d, a, x(k + 14), S34, &HFDE5380C md5_HH a, b, c, d, x(k + 1), S31, &HA4BEEA44 md5_HH d, a, b, c, x(k + 4), S32, &H4BDECFA9 md5_HH c, d, a, b, x(k + 7), S33, &HF6BB4B60 md5_HH b, c, d, a, x(k + 10), S34, &HBEBFBC70 md5_HH a, b, c, d, x(k + 13), S31, &H289B7EC6 md5_HH d, a, b, c, x(k + 0), S32, &HEAA127FA md5_HH c, d, a, b, x(k + 3), S33, &HD4EF3085 md5_HH b, c, d, a, x(k + 6), S34, &H4881D05 md5_HH a, b, c, d, x(k + 9), S31, &HD9D4D039 md5_HH d, a, b, c, x(k + 12), S32, &HE6DB99E5 md5_HH c, d, a, b, x(k + 15), S33, &H1FA27CF8 md5_HH b, c, d, a, x(k + 2), S34, &HC4AC5665 md5_II a, b, c, d, x(k + 0), S41, &HF4292244 md5_II d, a, b, c, x(k + 7), S42, &H432AFF97 md5_II c, d, a, b, x(k + 14), S43, &HAB9423A7 md5_II b, c, d, a, x(k + 5), S44, &HFC93A039 md5_II a, b, c, d, x(k + 12), S41, &H655B59C3 md5_II d, a, b, c, x(k + 3), S42, &H8F0CCC92 md5_II c, d, a, b, x(k + 10), S43, &HFFEFF47D md5_II b, c, d, a, x(k + 1), S44, &H85845DD1 md5_II a, b, c, d, x(k + 8), S41, &H6FA87E4F md5_II d, a, b, c, x(k + 15), S42, &HFE2CE6E0 md5_II c, d, a, b, x(k + 6), S43, &HA3014314 md5_II b, c, d, a, x(k + 13), S44, &H4E0811A1 md5_II a, b, c, d, x(k + 4), S41, &HF7537E82 md5_II d, a, b, c, x(k + 11), S42, &HBD3AF235 md5_II c, d, a, b, x(k + 2), S43, &H2AD7D2BB md5_II b, c, d, a, x(k + 9), S44, &HEB86D391 a = AddUnsigned(a, AA) b = AddUnsigned(b, BB) c = AddUnsigned(c, CC) d = AddUnsigned(d, DD) Next 'MD5 = LCase(WordToHex(a) & WordToHex(b) & WordToHex(c) & WordToHex(d)) MD5=LCase(WordToHex(b) & WordToHex(c)) 'I crop this to fit 16byte database password :D End Function %> index.asp(登陆页面)

log.asp <% Session.TimeOut=30 if request("action")="login" then admin=trim(request.form("admin")) for i=1 to len(admin) '用MID函数读出变量admin中i 位置的一个字符 manage=mid(admin,i,1) if manage="'" or manage="%" or manage="<" or manage=">" or manage="&" then '如果admin中含有' % < > &字符就转到出错页面 response.redirect "Error.asp" response.end end if next pwd=trim(request.form("pwd")) for i=1 to len(pwd) '用MID函数读出变量pwd中i 位置的一个字符 pass=mid(pwd,i,1) if pass="'" or pass="%" or pass="<" or pass=">" or pass="&" then '如果pass中含有' % < > &字符就转到出错页面 response.redirect "Error.asp" response.end end if next pwd=md5(pwd) if admin="" or pwd="" then Response.Redirect ("Index.asp") end if set rs=server.createobject("adodb.recordset") sql="select * from admin where admin='"&admin&"'and pwd='"&pwd&"'" rs.open sql,conn,1,1 if not rs.eof then session("admin")=admin response.redirect"main.asp" else response.redirect"Error.asp" response.end end if end if if request("action")="logout" then session("admin")="" response.redirect"../index.asp" end if %> error.asp 登陆出错,三秒钟自动返回 其它想加密的页面调用chk.asp pwd.asp修改密码 <% if request("action")="edit" then admin=trim(request.form("admin")) pwd=md5(trim(request.form("pwd"))) set rs=server.createobject("adodb.recordset") sql="select * from admin" rs.open sql,conn,3,2 rs("admin")=admin rs("pwd")=pwd rs.update set rs=nothing set conn=nothing response.write"<script language='javascript'>alert('修改成功!');location.href('Admin_Admin.asp');rs=server.createobject("adodb.recordset") sql="select * from admin" rs.open sql,conn,1,1 %> ------------------------
" size="20"> " size="20">
info.asp(读取服务器基本参数) 无标题文档
恭喜:你已成功登陆后台管理!
 服务器名:  <%=Request.ServerVariables("SERVER_NAME")%>
 服务器IP:  <%=Request.ServerVariables("LOCAL_ADDR")%>
 服务器端口:  <%=Request.ServerVariables("SERVER_PORT")%>
 服务器时间:  <%=now%>
 IIS版本:  <%=Request.ServerVariables("SERVER_SOFTWARE")%>
 服务器操作系统:  <%=Request.ServerVariables("OS")%>
 脚本超时时间:  <%=Server.ScriptTimeout%> 秒
 站点物理路径:  <%=request.ServerVariables("APPL_PHYSICAL_PATH")%>
 服务器CPU数量:  <%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%> 个
 服务器解译引擎:  <%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>
 本文件路径:  <%=Request.ServerVariables("PATH_TRANSLATED")%>
SQL语法大全 SQL语法大全 1. ASP与Access数据库连接: 2. ASP与SQL数据库连接: 建立记录集对象: set rs=server.createobject("adodb.recordset") rs.open SQL语句,conn,3,2 3. SQL常用命令使用方法: (1) 数据记录筛选: sql="select * from 数据表 where 字段名=字段 order by 字段名 [desc]" sql="select * from 数据表 where 字段名 like \'%字段%\' order by 字段名 [desc]" sql="select top 10 * from 数据表 where 字段名 order by 字段名 [desc]" sql="select * from 数据表 where 字段名 in (\'1\',\'2\',\'3\')" sql="select * from 数据表 where 字段名 between 1 and 2" (2) 更新数据记录: sql="update 数据表 set 字段名=字段 where 条件表达式" sql="update 数据表 set 字段1=1,字段2=2 …… 字段n=n where 条件表达式" (3) 删除数据记录: sql="delete from 数据表 where 条件表达式" sql="delete from 数据表" (将数据表所有记录删除) (4) 添加数据记录: sql="insert into 数据表 (字段1,字段2,字段3 …) values (1,2,3 …)" sql="insert into 目标数据表 select * from 源数据表" (把源数据表的记录添加到目标数据表) (5) 数据记录统计函数: AVG(字段名) 得出一个表格栏平均 COUNT(*|字段名) 对数据行数的统计或对某一栏有的数据行数统计 MAX(字段名) 取得一个表格栏最大的 MIN(字段名) 取得一个表格栏最小的 SUM(字段名) 把数据栏的相加 引用以上函数的方法: sql="select sum(字段名) as 别名 from 数据表 where 条件表达式" set rs=conn.excute(sql) 用 rs("别名") 获取统的计,其它函数运用同上。 (5) 数据表的建立和删除: CREATE TABLE 数据表名称(字段1 类型1(长度),字段2 类型2(长度) …… ) 例:CREATE TABLE tab01(name varchar(50),datetime default now()) DROP TABLE 数据表名称 (永久性删除一个数据表) 4. 记录集对象的方法: rs.movenext 将记录指针从当前的位置向下移一行 rs.moveprevious 将记录指针从当前的位置向上移一行 rs.movefirst 将记录指针移到数据表第一行 rs.movelast 将记录指针移到数据表最后一行 rs.absoluteposition=N 将记录指针移到数据表第N行 rs.absolutepage=N 将记录指针移到第N页的第一行 rs.pagesize=N 设置每页为N条记录 rs.pagecount 根据 pagesize 的设置返回总页数 rs.recordcount 返回记录总数 rs.bof
XML越来越热,关于XML的基础教程网络上也随处可见。可是一大堆的概念和术语往往让人望而生畏,很多朋友问我:XML到底有什么用,我们是否需要学习它?我想就我个人学习过程的心得和经验,写一篇比较全面的介绍文章。首先有两点是需要肯定的:   第一:XML肯定是未来的发展趋势,不论是网页设计师还是网络程序员,都应该及时学习和了解,等待只会让你失去机会;   第二:新知识肯定会有很多新概念,尝试理解和接受,您才可能提高。不要害怕和逃避,毕竟我们还年轻。   本文共分五大部分。分别是XML快速入门,XML的概念,XML的术语,XML的实现,XML的实例分析。最后附录介绍了XML的相关资源。作者站在普通网页设计人员的角度,用平实生动的语言,向您讲述XML的方方面面,帮助你拨开XML的神秘面纱,快速步入XML的新领域。 • 第一章:XML快速入门 • 一. 什么是XML? • 二. XML是新概念吗? • 三. 使用XML有什么好处? • 四. XML很难学吗? • 五. XML和HTML的区别 • 六. XML的严格格式 • 七. 关于XML的更多 • 第二章:XML概念 • 一. 扩展性 • 二. 标识 • 三. 语言 • 四. 结构化 • 五. Meta数据 • 六. 显示 • 七. DOM • 第三章:XML的术语 • 导言 • 一.XML文档的有关术语 • 二.DTD的有关术语 • 第四章:XML的语法 • 一.XML语法规则 • 二.元素的语法 • 三.注释的语法 • 四.CDATA的语法 • 五.Namespaces的语法 • 六.entity的语法 • 七.DTD的语法 • 第五章:XML实例解释 • 一.定义新标识 • 二.建立XML文档 • 三.建立相应的HTML文件 • 第六章:XML相关资源 五. XML和HTML的区别 XML和HTML都来自于SGML,它们都含有标记,有着相似的语法,HTML和XML的最大区别在于:HTML是一个定型的标记语言,它用固有的标记来描述,显示网页内容。比如表示首行标题,有固定的尺寸。相对的,XML则没有固定的标记,XML不能描述网页具体的外观,内容,它只是描述内容的数据形式和结构。 这是一个质的区别:网页将数据和显示混在一起,而XML则将数据和显示分开来。 我们看上面的例子,在myfile.htm中,我们只关心页面的显示方式,我们可以设计不同的界面,用不同的方式来排版页面,但数据是储存在myfile.xml中,不需要任何改变。 (如果你是程序员,你会惊讶的发现,这与模块化面向对象编程的思想极其相似!其实网页何尝不是一种程序呢?) 正是这种区别使得XML在网络应用和信息共享上方便,高效,可扩展。所以我们相信,XML做为一种先进的数据处理方法,将使网络跨越到一个新的境界。 六. XML的严格格式 吸取HTML松散格式带来的经验教训,XML一开始就坚持实行"良好的格式"。 我们先看HTML的一些语句,这些语句在HTML中随处可见: 1. sample 2.sample 3.sample 4.samplar 在XML文档中,上述几种语句的语法都是错误的。因为: 1.所有的标记都必须要有一个相应的结束标记; 2.所有的XML标记都必须合理嵌套; 3.所有XML标记都区分大小写; 4.所有标记的属性必须用""括起来; 所以上列语句在XML中正确的写法是 1. sample 2.sample 3.sample 4.samplar   另外,XML标记必须遵循下面的命名规则: 1.名字中可以包含字母、数字以及其它字母; 2.名字不能以数字或"_" (下划线) 开头; 3.名字不能以字母 xml (或 XML 或 Xml ..) 开头; 4.名字中不能包含空格。 在XML文档中任何的差错,都会得到同一个结果:网页不能被显示。各浏览器开发商已经达成协议,对XML实行严格而挑剔的解析,任何细小的错误都会被报告。你可以将上面的myfile.xml修改一下,比如将改为,然后用IE5直接打开myfile.xml,会得到一个出错信息页面: XML轻松学习手册 ajie
考试系统论文 摘要 随着计算机技术的普及和提高,计算机等级考试成为热门,等级考试的目的在于适应社会主义市场经济建设的需要,一方面是为了促进计算机知识的普及和计算机应用技术的推广,另一方面是为劳动力市场服务,即为劳动人员提供其计算机应用知识与能力的证实,为用人部门录用和考核工作人员提供一个统一、客观、公正的评价标准. 该系统用于用户登录、参加等级考试以及治理员进行试题录入、修改、删除、成绩查询、治理用户的ASP应用程序。它应该具有开放性、方便性和灵活性。治理员不仅可以轻松地向题库添加、修改和查询试题,而且还可以自动新增考试等级并建立相应的数据;它还答应用户根据自己的需求,选取考试等级。考生进行有效的身份验证登录后,选择考试等级,并要求在规定的时间内进行答题,当达到规定的时间后,系统将自动予以提示。一旦考生做完交卷后便能立即看到自己的考试成绩,并且其分数将被记入库中以供审核和查阅;另外,还可完全由计算机自动灵活、随机的抽取试题库中的各类试题组成各种形式的试卷,其内容会随着库中试题的改变而改变,而且,不同的考生生成的试题是不同的。 系统选用的开发软件是ASP,后台数据库为ACCESS2000 系统的开发用结构化设计思想。本文介绍了考试系统的开发初衷和背景,系统的开发工具,结构化开发的具体步骤,其中包括实体-联系模型,数据流图,功能结构图等 关键字:考试试卷自动系统ASPvbscriptaccessresponserequest, Summary Alongwiththefastdevelopmentincomputertechnology,wehavegottenbigprogressinschoolscienceandinformationmanagement.Soitneedsequaldevelopmentineverypart.Theschoolwillbebuildinganinformationmanagementandeducationalplatfromhardwareandsoftwaretwosides.Idevelopedthissystemisinordertoreducetheteacherstesting,enhancethestudentssecrecy.Itcansavemorepeoplemoneyandtimethantraditionmethods. Thesystemisdedicatedtousersdownload,onlineexaminationandmanagersparticipateintheexaminationincluded,modify,delete,performanceenquiries,managementuserASPapplications.Itshouldbeopen,convenienceandflexibility.Managersnotonlytothedatabankcaneasilyadd,modifyandinquiryquestions,butalsocanautomaticallycreatenewexaminationgradingandthecorrespondingdata;Italsoallowsusersonthebasisoftheirownneeds,selectingexaminationgrades.Candidatesforeffectiveidentificationandrecorded,theselectionexaminationgrading,andrequestsinthetimeallowed,whenaprescribedtime,thesystemwillautomaticallybemade.Oncecandidateswillbeabletocompletehomeworkimmediatelyafterseeingtheirexaminationresultsandtheirscoreswillberecordedandputinstorage,forauditandinspection;Inaddition,thecomputercouldbecompletelyautomatedflexible,randomsamplesofthevarioustypesoftestquestionsfortheformationofvariousformsofpaper,itscontentwillchangewiththechangeintheexamination,but,differentcandidatesgeneratedquestionsaredifferent. ThesystemchoosesthesoftwareofdevelopmentthatuseisASP,andACCESS2000. Thesystemdevelopmentsadoptideaofconstructiondesigning.Thesystemmanualintroducedtheoriginalintentionandbackgroundofthisexaminationsystem,thetoolofdevelopmentofthesystem,thedetailsprocessofconstructiondevelopment,itcontenttheentity-model,thedatastreamchart,functionandconfigurationchart,andothernecessarychartexplanations. Keywords:testpaperautosystemASPvbscriptaccessresponserequest, 前言 计算机技术没有应用到考试上时,组织一次考试至少要经过五步,人工出题、考生考试、人工阅卷、成绩评估和试卷分析。教师的工作量将会越来越大,并且其工作将是一件十分烦琐和非常轻易出错的事情,明显的传统的考试方式已经不能适应现代考试的需要。随着计算机应用的迅猛发展,应用不断扩大,如教学和虚拟大学的出现等等,且这些应用正逐步深入到千家万户。人们迫切要求利用这些技术来进行等级考试,以减轻教师的工作负担及提高工作效率,与此同时也提高了考试的质量,从而使考试更趋于公证、客观,更加激发学生的学习爱好。例如目前许多国际闻名的计算机公司所举办的各种认证考试绝大部分采用这种方式。 等级考试是现阶段研究开发的一个热点。它是建立在国际互联网上的应用系统,客户端的配置可以极为简单, 使考试不受地域的局限。一个完备的等级考试系统可以使用户在网上学习过后及时检验自己的学习效果, 已发现自己的不足,使得学习效率得到很大提高。等级考试系统中题目的生成、试卷的提交、成绩的批阅等都可以在 上自动完成。只要形成一套成熟的题库就可以实现考试的自动化。这样一来,教师所要做的只是精心设计题目、维护题库, 而不是组织考试,从而大大减轻了教师的负担,这表明其经济性是相当可观的。为了适应新形势的发展, 我进行了这一系统的初步设计工作,也可以说是做一个初步的探索,希望它能够在各类考试中发挥高效、 便捷的作用,把老师从繁重的工作中解脱出来! 目前,应用软件运行的模式主要有二类:Client/server模式,Browser/Web模式。前者主要的缺点是维护、 升级较麻烦,后者是近几年伴随Internet迅速发展起来的一种技术,它与客户/服务器方式类似, 客户端是一个标准的浏览器,服务器端是WebServer,而WebServer与数据库和应用服务器的紧密结合, 使得这种模式的应用范围不断扩大,它已不仅仅用于网上查询,有很多部门的业务系统、 企业的MIS系统纷纷采用这种模式,它的主要优点是便于扩充应用、升级维护简便。 另外,考试系统的软件也必将不断的更新;同时软件产品本身就要经过一个不断自我完善的过程。 基于上述考虑,用Browser/Web模式来设计考试系统比较合适,服务器端我们采用Access数据库系统和 ASP组件来构成考试的应用服务系统;客户端采用浏览器来完成考试全过程,同时可进行远程系统维护和治理。 利用和数据库技术,结合目前硬件价格普遍下跌与宽带网大力建设的有利优势,应用ActiveServerPage技术,我开发了基于B/S模式多用户等级考试系统这一程序。它运用方便、操作简单,效率很高。现阶段虽只实现了试卷的客观题部分,但已具有用户注册、多用户同时等级考试、动态随机出题、时间控制、自动判卷,试题录入、修改题库、用户治理、科目治理、治理员治理、分数治理等重要功能,也就是说实现了真正的无纸化考试,满足任何授权的考生随时随地考试并迅速获得成绩,同时也大大减轻了教师出题、出题和判卷等繁重的工作量。 第一章 系统设计相关原理 该在线考试系统主要采用ASP、HTML、Access数据库、VBScript、SQL等技术和工具〖本文来自论文路上,Www.Lw63.Com,专业毕业设计〗整体设计遵循软件工程的方法,经过需求分析、总体设计、文档和代码的编制、模块测试和系统实现几个阶段。下面就对这几种技术和方法做一个概述。 2.统一的语言 SQL可用于所有用户的DB活动模型,包括系统管理员、数据库管理员、 应用程序员、决策支持系统人员及许多其它类型的终端用户。基本的SQL 命令只需很少时间就能学会,最高级的命令在几天内便可掌握。 SQL为许多任务提供了命令,包括: ☆查询数据 ☆在表中插入、修改和删除记录 ☆建立、修改和删除数据对象 ☆控制对数据和数据对象的存取 ☆保证数据库一致性和完整性 以前的数据库管理系统为上述各类操作提供单独的语言,而SQL将全部任务统一在一种语言中。 3.是所有关系数据库的公共语言 由于所有主要的关系数据库管理系统都支持SQL语言,用户可将使用SQL的技能从一个RDBMS转到另一个。所有用SQL编写的程序都是可以移植的。SQL是PostgreSQL(和大多数其它关系型数据库)用做查询语言的语言。它是可以移植的,并且容易学习使用。但是所有SQL语句都必须由数据库服务器独立地执行。这就意味着客户端应用必须把每条查询发送到数据库服务器,等待它处理这个查询,接收结果,做一些运算,然后给服务器发送另外一条查询。所有这些东西都会产生进程间通讯,并且如果客户端在另外一台机器上甚至还会导致网络开销。如果使用了 PL/pgSQL,那么可以把一块运算和一系列查询在数据库服务器里面组成一个块,这样就拥有了过程语言的力量并且简化SQL的使用,因而节约了大量的时间,因为用不着付出客户端/服务器通讯的过热。通过使用PL/pgSQL,应用可以获得可观的性能提升。 2.2 系统应该具备的基本功能 ☆用户注册:用户可以进行注册,然后登录。 ☆用户信息的管理:管理员可以增删用户 ☆试题模型设置:设置各科目试题的每种题型的数量和分。 ☆试题库管理:分科目,对单选、多选两种题型试题库的管理,使试题的增删、编辑更为简便。 ☆试卷生成:可以指定试卷的各题型的数量,从试题库里随机抽取试题生成一份原始试卷。 ☆在线考试:系统严格控制整个考试过程,实行时间的监控与权限的控制,考生需要在限定的考试时间内交卷。 ☆计算机自动阅卷:本系统只考虑客观题,要求计算机能自动阅卷,然后马上显示出考生分数。 ☆成绩查阅:考生考完以后,管理员应该能对所有纪录进行查询,并应该可以删除指定纪录。 除了实现上述功能以外,在线考试系统还应该具有友好、简洁的界面,安全性要高,稳定性要强,能够满足100人以上同时及进行在线考试。 3.3.3 用户、管理员权限 ☆管理员:在此系统中可以由若干个管理员,即系统管理员。他们具有一般用户所没有的权限,即具有管理用户、试题以及试卷等内容的权力。它不需注册,在数据库有一个表来存放相关信息,可由以存在的管理员添加或删除管理员。 ☆一般用户:主要是指学校的学生和企事业单位的培训对象等。 3.3.4 功能模块详细设计 下面,对各个功能模块分别进行详细讨论,具体情况见系统源程序。 3.3.4.1 管理模块 管理员可以向题库中添加各种类型且符合要求的试题,也可以对它们进行修改和删除。同时,管理员也能对科目、用户、考试记录等数据进行管理。 1. 试题管理 (1)试题录入 首先,用户选择试题所属科目。若菜单中没有该科目,则可以新增一个。返回、刷新一次页面,即可看到新增的科目名称。而且,在本系统中其它需要选择科目的地方也会自动更新。其次,每道试题有类型、试题内容与选项和答案等栏目。管理员输入完以后,即可看到预览效果。如果输入不合法,或者该科题库中已有该试题编号和内容等,则系统给出相应的提示或警告,以待更正。 (2)试题修改 管理员还可以对试题进行修改。不过,对于各表中的主键不用修改,避免了造成系统中的数据混乱,或者覆盖其它有用数据的现象。如果用户执行了非法操作,则必须重新操作。 (3)试题删除 管理员可以删除不再需要的试题。 2. 科目管理 (1)添加科目 其基本信息有科目名称、题型、题量和考试总时间等,对于用户输入的不符合系统要求的数据,系统仍旧给出提示或警告。 (2)科目删除 管理员可以删除不再需要的科目。 3.用户管理 管理员可以通过管理界面添加或删除用户。 4.管理管理员 管理员可以通过管理界面添加新管理员或删除原有管理员。 5.考试记录管理 系统中的管理员可以查询考试记录,也可以删除考试纪录。 3.3.4.2在线考试模块 进入在线考场是本系统最重要的部分之一。因为一个系统如果涉及到现实的话,就必须考虑得十分周到、完善。考生登录后,只要选择考试科目以后,就可以调出试卷进行在线考试。为了实现动态随机不重复的抽取试题,需要在选题过程中每选出一题,就要在试题库中作相应的标志,以便下次不会重复取出此题。试卷出来后要对试题库中的标志位复原。这样就会使每个考生的试卷都不同。考生的其答题信息通过单、复选按钮选择答案来反映。考试结束采取自主交卷和到了规定的时间自动题示有机结合的方式办法予以实现。 3.3.4.2用户注册模块 该模块的功能是实现用户远程注册。用户输入想要注册的用户名和密码,提交之后由系统判断该用户是否已经存在,如果存在,就给出相应信息,如果不存在,就把用户输入的用户名和密码写到数据库中,完成注册。 该文件就是考试界面,实现真正的动态随机选题,并对每个考生的考试时间进行监控,到结束时间后自动给出提示。 该文件的总体构架是使用了if else 语句进行了一个选择,刚进入该页面submit1得肯定不等于“开始考试”,所以先显示出“开始考试”的按钮。按下以后,首先把当前时间以分种为单位存储在session的变量starttime中。然后进入随机抽取试题部分,单选题和多选题的抽取很相似,只不过一个是单选按钮,一个是多选按钮罢了。这里只解释单选题的部分。 strid1=""是定义了一个字符串变量,并先赋为空。 Randomize是产生随机种子,在使用rnd()函数之前一定要先用Randomize产生随机种子才能实现其产生0~1之间随机数的功能。 for i=1 to session("singlenumber")直到next是选择singlenumber(代表某科目的单选题数量)个单选题。 下面的代码实现了从数据库中随机不重复的选题: set rs=server.createobject("adodb.recordset") sql="select * from question where subjectname='"&session("selectsubjectname") & "'and type='单选题' and haveselect=0 " rs.open sql,conn,3,2 count=rs.recordcount temp=fix(count*rnd(10)) rs.move temp rs("haveselect")=1 rs.update strid1=strid1 & rs("ID") & "," 其中haveselect标志某题是否已经被选过。 Count变量用来存放所有未被选过的单选题的总数。 temp变量用来存放0~Count之间的随机整数rs.move temp是将当前记录移到第temp条纪录。 rs("haveselect")=1是将当前选出的纪录的标志位设为1,然后用rs.update把数据库中的相应标志位改为1。 strid1=strid1 & rs("ID") & ","是将所有选出的试题的id号用逗号分割后存储在strid1一个变量中,以方便的把所有选出的试题的id号传到result.Asp文件中,这也是本设计的一个独特的地方。需要说明的是strid1变量的最后是一个逗号,在下一个文件中会详细说明如何进行处理。 在线考试系统的实现 摘要:人类已经步入了崭新的21世纪,以Internet技术为代表的信息技术为人类创造了一种新的不受地域、时间和计算机本身的约束的信息交流、共享和协作方式。21世纪是信息化的社会,数据信息应用已进入大规模的服务阶段。考试作为最直接的体现信息化社会中人们的知识水平的一种方式,是目前使用最为广泛的形式之一,传统的考试从出题、组卷、印刷,到试卷的分发、答题、收卷、再到判卷、公布成绩,整个过程都需要人工参与,周期长,工作量大,容易出错,还要有适当的保密工作,使的整个考试的成本较大。所以,实现无纸化、网络化、自动化的计算机考试系统,具有深远的现实意义和使用价。 本系统采用B/S模式,采用现在使用广泛的ASP语言和对数据文件安全保护性极好的SQL Server2000设计开发出的一个实现在线考试的动态网站—基于Web的考试管理系统,也就是在线考试系统。该系统基本上具备一个网上数据传递的功能,具体分为用户层和管理层两大模块,用户层模块实现用户的考试、查询功能;管理实现题库的管理、试卷的生成、查询、修改、删除等功能。系统采用三层结构,统一的管理题库,自动组卷,自动判卷,极大的节省了人力、物力,提高了效率。 本文主要介绍了本课题的开发背景,所要完成的功能和开发的过程等,并给出了在开发过程中的一些经验体会。 关键词:B/S模式; WEB; 用户层; 管理层 Online Examination System To Achieve Abstract:We have got into the completely new 21Century, and as the typical of information technology, the internet creates a new way of information exchanged and shared for humans which isn’t restricted by the district, time, and computer itself. The 21-century is an informational society, in which the data information is exerted for a large service scale. The examination, as a way of directly embodying the knowledge of humans in the informational society, is one of the most common forms in present. However, humans have to participate into the whole process of traditional examination, whatever the stages of arranging examination are, such as, collecting the questions, printing, sending, and turning in paper, correcting answers or declaring the results, so that all these stages cause the long cycle, heavy workload, and more mistakes in the course of making an examination. Additionally, we also sometimes should pay attention to the secrecy. The above factors are enabling to raise the examination cost. So, to be the paperless, internalization, and automatic computer examination systems have confounded signification and valuable. Employing the B/S model, ASP language and the dynamic website developed by the SQL Server2000 and well protecting the data document---- on the basis of Web examination system, actually, the system has a basic foundation of sending internet dates, which is divided into two models, that is, the Consumer and the Administer. The Consumer is to be the foundation of the registration and landing, examination and inquired; the Administer is to be the foundation of the paper management, the paper formation, inquiry, amendment, and delectation. The system has three structures which are separately the unity of the paper management, automatic formation, and automatic correction, so it saves the labour, worthy, and improve the work efficiency. The paper mainly introduces the developing background, the foundations and the developing process, Meanwhile, we are sharing the experience from the developing. key words:B/S model ; WEB ; the costume; the domination 目 录 前言 1 1 在线考试系统的现状分析 2 2 开发工具简介和数据库技术 3 2.1 开发工具的选择 3 2.2 ASP简介 3 2.2.1 ASP概述 3 2.2.2 ASP的特点 3 2.3 SQL Server 2000简介 4 2.3.1 SQL Server概述 4 2.3.2 SQL Server的运行环境 7 2.3.3 SQL Server 安全性 7 2.3.4 SQL Server的特性 7 2.4 用来操纵数据的SQL命令 8 3 系统总体设计 9 3.1 系统需求分析 9 3.1.1 用户考试查询功能 10 3.1.2 系统管理员管理功能 11 3.2 系统功能模块设计 12 3.2.1 前台考试系统 12 3.2.2 后台管理员模块 12 3.3系统结构图 13 3.3.1 系统结构图 13 3.4实体关系图(ER图) 15 3.4.1 用户(学生或管理员)关系 15 3.4.2 试卷关系 15 3.4.3 题库关系 15 3.4.4考试过用户关系 16 3.4.5用户答题关系 16 3.5数据库的设计 17 3.5.1 数据库需求分析 17 3.5.2 数据库逻辑设计 17 3.5.3 数据库连接文件 19 4 系统功能模块 20 4.1前台考试模块 20 4.1.1 考试用户登陆模块 20 4.1.2 验证用户模块 21 4.1.3 考试开始模块 22 4.1.4 考试结束模块 26 4.2后台管理员模块 28 4.2.1 管理员登陆模块 29 4.2.2 试题创建模块 30 4.2.3 题库管理模块 31 4.2.4 试卷管理模块 34 4.2.5 考生管理模块 36 4.2.6 成绩统计模块 38 5 结束语 43

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧