|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
缺点:安全性不是太差了,还行,只要你充分利用系统自带的工具;唯一缺点就是执行效率慢,如何进行网站优化以后,效果会比较好。 有伴侣问关于XdownPage2.0的利用的成绩。我如今举一个复杂的例子,从我的程序中摘出来的。(太忙,偶然间再举稍稍庞大的例子)
四个文件:
conn.asp数据库连接代码
config.asp一段关于排序相干的代码
pages.asp分页代码
index.asp主程序
排序时用到的两个图片:
为了精简代码,我将良多与本功效有关的代码都往失落了,款式代码也往失落了,以是界面很丢脸。
------------------------------------
conn.asp
------------------------------------
dbuser="scott"
dbpwd="tiger"
dbsource="oracleDB"
Setconn=Server.CreateObject("ADODB.Connection")
conn.CommandTimeout=60
connstr="Provider=MSDAORA.1;UserID="&dbuser&";Password="&dbpwd&";DataSource="&dbsource
conn.Openconnstr
subCloseConn()
conn.close
setconn=nothing
endsub
------------------------------------
config.asp
------------------------------------
sImageDir="/"&getRoot()&"/images/"图片路径
upOrderFlag=""&pHeaderTitle&""&writeOrderDir(pOrderField,tOrderField,tOrderDir)&"</span>"
endsub
取得以后假造目次的名字
functiongetRoot()
url=Request.ServerVariables("URL")
url=right(url,len(url)-1)
getRoot=mid(url,1,instr(url,"/")-1)
endfunction
(3)asp->htm过滤特别字符,(单,双引号和其他html敏感字符)以避免asp字符串嵌进到htm中显现数据时丧失数据
functionFilterParam3(str1)
fp1=str1
ifisnull(fp1)orisempty(fp1)thenfp1=""
fp1=server.HTMLEncode(fp1)
FilterParam3=fp1
endfunction
------------------------------------
pages.asp
------------------------------------
分页代码靠过去就能够了,别忘了将一些忘了正文的申明笔墨正文失落
------------------------------------
index.asp
------------------------------------
<%Response.Buffer=-1%>
<!--#includefile="conn.asp"-->
<!--#includefile="config.asp"-->
<!--#includefile="pages.asp"-->
<%
费率办理
writer:northsnow
createdate:050802
%>
<scriptlanguage="javascript">
//实行静态排序
functiongotoOrder(uOrderField,uOrderDir)
{
frmHidden.currentpage.value="1";
frmHidden.flag.value="query";
frmHidden.orderField.value=uOrderField;
frmHidden.orderDir.value=uOrderDir;
frmHidden.submit();
}
//实行查询前将查询前提写到埋没表单
functionquery()
{
varoFormHidden=document.frmHidden;
if(!oFormHidden)returnfalse;
oFormHidden.currentpage.value="";
oFormHidden.flag.value="query";
oFormHidden.sm.value=frmList.sm.value;
oFormHidden.cj.value=frmList.cj.value;
oFormHidden.cj_code.value=frmList.cj_code.value;
oFormHidden.submit();
}
//重置查询前提
functionmyreset()
{
frmList.sm.value="";
frmList.cj.value="";
frmList.cj_code.value="";
}
</script>
<%onerrorresumenext
猎取参数
dimcx,cj,cj_code
dimcurrentpage,flag,pagesize,rsTotalCount,orderDir,orderField
currentpage=trim(request.form("currentpage"))
div_p=trim(request("div_p"))
flag=trim(request("flag"))
pagesize=trim(request("pagesize"))
rsTotalCount=trim(request("rsTotalCount"))
orderDir=trim(Request("orderdir"))
orderField=trim(Request("orderfield"))
cx=Request("cx")
cj=trim(request("cj"))
cj_code=trim(request("cj_code"))
sm=trim(request("sm"))
%>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
</head>
<bodytopmargin="4"><divalign=center><spanid="qSpan">
<formname="frmList"action="#"method="post">
<spanclass="titlestyle">变化费率办理</span><br>
<fieldsetstyle="width:100%;padding:2px2px"align="center"class="border">
<legendclass="border"align=rightstyle="border:0px">
<ahref="#"tabindex="1">查询</a>|
<ahref="#">重置</a>
</legend>
<tablewidth="100%"align="center">
<tr>
<tdvalign="middle"align="center">
<tablewidth="100%"border="0"cellspacing="0"cellpadding="0">
<tr>
<tdalign="center"width="50%">费率申明:
<inputname="sm"type="text"class="line"value="<%=sm%>"></td>
<tdalign="center"width="50%">车间:
<inputname="cj"type="text"class="line"readonlysize="22"><inputname="cj_code"type="hidden"class="line"size="22"><ahref="#"><imgsrc="http://www.webjx.com/htmldata/images/viewnew.gif"alt="查找车间"border="0"></a></td>
</tr>
</table>
</td>
</tr></form>
</table>
</fieldset></span>
<tablewidth=100%align=centerborder="0"cellpadding="0"cellspacing="0">
<formname="manForm"><tr><tdalign=centervalign=top><tableborder="0"width="100%"cellspacing="0"cellpadding="0">
<%
读取数据
setrs=server.CreateObject("adodb.recordset")
rs.CursorLocation=3
//构成最初的sql
sql="select*fromV_FL_201where1=1"
ifcj_code""then
sql=sql&"anddept_code="&cj_code&""
endif
ifsm""then
sql=sql&"andsmlike%"&sm&"%"
endif
剖析排序
orderStr=""
iforderField""then
orderStr="orderby"&orderField
iforderDir""thenorderStr=orderStr&""&orderDir
endif
iforderStr=""thenorderStr="orderbydept_name"
iforderStr""thensql=sql&orderStr
ifpagesize=""thenpagesize=15
Setmypage=newxdownpage创立工具
mypage.getconn=conn失掉数据库毗连
mypage.pagesize=pagesize设置每页的纪录条数据为5条
mypage.totalRecordCount=rsTotalCount传送总纪录数,分页的时分不必每次都往查一次
mypage.getsql=sql
mypage.GetSubmitForm="frmHidden"
Response.write(mypage.GetSubmitForm1())
setrs=mypage.getrs()前往Recordset
%>
<trheight="28">
<tdalign=centervalign=top>
<tablecellspacing="1"class="tableBorder1"cellpadding=0bordercolordark=#FFFFFFwidth="100%"bordercolorlight=#014E4B>
<trheight="25">
<tdvalign="center"align="left"width="6%"class="noticetitle"background="../images/topbg.gif">
<%WriteOrderHeader"车间","dept_name",OrderField,OrderDir%></td>
<tdvalign="center"align="left"width="6%"class="noticetitle"background="../images/topbg.gif">
<%WriteOrderHeader"申明","sm",OrderField,OrderDir%></td>
<tdvalign="center"align="left"width="6%"class="noticetitle"background="../images/topbg.gif">
<%WriteOrderHeader"费率","fl",OrderField,OrderDir%></td>
</tr>
<%i=1
dowhilenotrs.EOF%>
<tr<%ifimod2=0then%>class="tr2"<%else%>class="tr1"<%endif%>>
<tdheight="23"align="center"class="inputstyle"valign="top"readonlytitle="<%=FilterParam3(rs("dept_name"))%>">
<inputname="cj_name<%=i%>"size="18"value="<%=FilterParam3(rs("dept_name"))%>"readonlyclass="no"></td>
<tdheight="23"align="center">
<inputname="sm<%=i%>"style=width:100%maxlength="30"value="<%=FilterParam3(rs("sm"))%>"class="no"></td>
<tdheight="23"align="center">
<inputname="fl<%=i%>"style=width:100%value="<%=FilterParam3(rs("fl"))%>"class="no"></td>
</tr>
<%i=i+1
rs.MoveNext
loop%>
</table>
</td>
</tr>
<tr><td><%mypage.showpage()%>
<%mypage.ShowPageSizeChange()%></td></tr>
</table>
<td></tr></form>
</table>
<!--埋没表单,用于页面导航和查询。-->
<formname="frmHidden"method="post"action="#">
<inputtype="hidden"id="div_p"name="div_p"value="<%=div_p%>">
<inputtype="hidden"name="flag"value=""ID="Hidden1">
<inputtype="hidden"name="pagesize"value="<%=pagesize%>"ID="1">
<inputtype="hidden"name="currentpage"value="<%=currentpage%>"ID="Hidden2">
<inputtype="hidden"name="rsTotalCount"value="<%=rsTotalCount%>"ID="2">
<inputtype="hidden"name="orderField"value="<%=orderField%>"ID="Hidden7">
<inputtype="hidden"name="orderDir"value="<%=orderDir%>"ID="Hidden8">
<inputtype="hidden"name="sm"value="<%=sm%>">
<inputtype="hidden"name="cj"value="<%=cj%>">
<inputtype="hidden"name="cj_code"value="<%=cj_code%>">
</form>
</body>
</html>
这点代码的输入界面以下:
Windows本身的所有问题都会一成不变的也累加到了它的身上。安全性、稳定性、跨平台性都会因为与NT的捆绑而显现出来; |
|