仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 602|回复: 9
打印 上一主题 下一主题

[学习教程] ASP网页设计完成分页的例子-利用存储历程来完成分页...

[复制链接]
变相怪杰 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:33:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
ASP在国内异常流行,因为国内大多使用的是盗版的Windows和盗版的SQLServer,而ASP+COM+SQLServer实际上也是一种不错的搭配,其性能也不输于PHP+MYSQL,特别是Windows系统和SQLServer都有图形界面,比APACHE和MYSQL易于维护,因此对于不重视知识产权的国家来说也是一种不错的选择。在网上会商怎样完成分页有良多程序,我在这里向人人先容一种完成分页的新的办法,利用存储历程来完成分页
因为这段程序写的对照早,谁人时分还没有SQL7,每个Varchar只能撑持255个字符,以是接纳了一种对照笨的举措,假如人人有乐趣,请往http://www.chinaasp.com/sqlbbs/default.asp的数据库论坛宣布定见,我会看情形,决意是不是将这个存储历程修正成为SQL7的存储历程;
并在此起到一个举一反三的感化
这个程序只能到达10个分页
ifexists(select*fromsysobjectswhereid=object_id(dbo.sp_productPage)andsysstat&0xf=4)
dropproceduredbo.sp_productPage
GO

CREATEPROCEDUREsp_productPage
@intStartTINYINT=1,
@intEndTINYINT=10
withENCRYPTION
AS
Declare@strProductIDVARCHAR(8),@strProductNameVARCHAR(20),
@strSQL1VARCHAR(100),
@strSQL2VARCHAR(100),
@strSQL3VARCHAR(100),
@strSQL4VARCHAR(100),
@strSQL5VARCHAR(100),
@strSQL6VARCHAR(100),
@strSQL7VARCHAR(100),
@strSQL8VARCHAR(100),
@strSQL9VARCHAR(100),
@strSQL10VARCHAR(100),
@intCCountTINYINT,
@intCountTINYINT,
@iTINYINT
select@i=1
Declarecur_ProductSCROLLCURSORFor
SelectProductID,ProductNamefromKF_ProductorderbyProductID
Select@intCCount=count(productId)FromKF_Product
opencur_Product
FetchABSOLUTE@intStartFromcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Select@intCount=@intStart
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL1=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)+Union
End
else
Begin
Select@strSQL1=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL2=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)+Union
End
else
Begin
Select@strSQL2=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL3=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)+Union
End
else
Begin
Select@strSQL3=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL4=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)+Union
End
else
Begin
Select@strSQL4=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL5=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)+Union
End
else
Begin
Select@strSQL5=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL6=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)+Union
End
else
Begin
Select@strSQL6=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL7=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)+Union
End
else
Begin
Select@strSQL7=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL8=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)+Union
End
else
Begin
Select@strSQL8=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL9=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)+Union
End
else
Begin
Select@strSQL9=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
Fetchcur_ProductInto@strProductID,@strProductName
if@@FETCH_STATUS=0
Begin
Select@intCount=@intCount+1
Select@strSQL10=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
End
else
Begin
Select@strSQL10=SelectproductId=+@strProductID+,productName=+@strProductName+,ProductCount=+convert(VARCHAR,@intcCount)+,ProductSumCount=+convert(VARCHAR,@intCCount)
GotoEndPro
End
EndPro:
closecur_Product
DEALLOCATEcur_Product
print@strSQL1
print@strSQL2
print@strSQL3
exec(@strSQL1+@strSQL2+@strSQL3+@strSQL4+@strSQL5+@strSQL6+@strSQL7+@strSQL8+@strSQL9+@strSQL10)
GO
存储历程创立乐成后,就能够在ASP中做以下挪用
strSQL="sp_productPage1,10
rst.openstrSQL,conn,3,1
就能够了


帮助用户快速实现各种应用服务,ASP商有整合各方面资源的能力,可在短期内为用户提供所需的解决方案。例如,典型的ERP安装,如果要在客户端安装的话需要半年到二年的时间,但是美国的一些ASP商如USI和CORIO能在90—120天内提供ERP应用方案。
透明 该用户已被删除
沙发
发表于 2015-1-17 18:13:23 | 只看该作者
下面简单介绍一下我学习ASP的方法,希望对想学习ASP的朋友有所帮助...
简单生活 该用户已被删除
板凳
发表于 2015-1-21 07:10:11 | 只看该作者
弱类型造成潜在的出错可能:尽管弱数据类型的编程语言使用起来回方便一些,但相对于它所造成的出错几率是远远得不偿失的。
柔情似水 该用户已被删除
地板
发表于 2015-1-30 10:43:07 | 只看该作者
接下来就不能纸上谈兵了,最好的方法其实是实践。实践,只能算是让你掌握语言特性用的。而提倡做实际的Project也不是太好,因为你还没有熟练的能力去综合各种技术,这样只能使你自己越来越迷糊。
乐观 该用户已被删除
5#
发表于 2015-2-6 10:09:46 | 只看该作者
运用ASP可将VBscript、javascript等脚本语言嵌入到HTML中,便可快速完成网站的应用程序,无需编译,可在服务器端直接执行。容易编写,使用普通的文本编辑器编写,如记事本就可以完成。由脚本在服务器上而不是客户端运行,ASP所使用的脚本语言都在服务端上运行。
飘灵儿 该用户已被删除
6#
发表于 2015-2-15 22:55:15 | 只看该作者
我可以结合自己的经验大致给你说一说,希望对你有所帮助,少走些弯路。
山那边是海 该用户已被删除
7#
发表于 2015-3-4 17:05:37 | 只看该作者
学习ASP其实应该上升到如何学习程序设计这种境界,其实学习程序设计又是接受一种编程思想。比如ASP如何学习,你也许在以前的学习中碰到过。以下我仔细给你说几点:
愤怒的大鸟 该用户已被删除
8#
发表于 2015-3-11 20:31:52 | 只看该作者
封装性使得代码逻辑清晰,易于管理,并且应用到ASP.Net上就可以使业务逻辑和Html页面分离,这样无论页面原型如何改变,业务逻辑代码都不必做任何改动;继承性和多态性使得代码的可重用性大大提高。
冷月葬花魂 该用户已被删除
9#
发表于 2015-3-19 11:43:56 | 只看该作者
运用经典的例子。并且自己可以用他来实现一些简单的系统。如果可以对他进行进一步的修改,找出你觉得可以提高性能的地方,加上自己的设计,那就更上一个层次了,也就会真正地感到有所收获。
admin 该用户已被删除
10#
发表于 2015-3-27 23:37:47 | 只看该作者
我想问如何掌握学习节奏(先学什么再学什么)最好详细点?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-14 20:38

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表