风格选择:黄绿 | 天蓝 | 红灰
导航
SEO首页>>网站建设>>程序开发>>ASP 编程中 20 个非常有用的例子(11-20)
ASP 编程中 20 个非常有用的例子(11-20)

11.有没有办法保护自己的源代码,不给人看到

答:可以去下载一个微软的Windows s cript Encoder,它可以对asp的脚本和客户端javas cript/vbs cript脚本进行加密。。。不过客户端加密后,只有ie5才能执行,服务器端脚本加密后,只有服务器上安装有s cript engine 5(装一个ie5就有了)才能执行。

12.怎样才能将 query string 从一个 asp 文件传送到另一个?

答:前者文件加入下句: Response.Redirect("second.asp?" & Request.ServerVariables("QUERY_STRING")

13.global.asa文件总是不起作用?

答:只有web目录设置为web application, global.asa才有效,并且一个web application的根目录下 global.asa才有效。IIS4可以使用Internet Service Manager设置application setting 怎样才能使得htm文件如同asp文件一样可以执行脚本代码?

14.怎样才能使得htm文件如同asp文件一样可以执行脚本代码?

答:Internet Sevices Manager - > 选择default web site - >右鼠键- >菜单属性-〉主目录- > 应用程序设置(Application Setting)- > 点击按钮 "配置"- > app mapping - >点击按钮"Add" - > executable browse选择 \WINNT\SYSTEM32\INETSRV\ASP.DLL EXTENSION 输入 htm method exclusions 输入PUT.DELETE 全部确定即可。但是值得注意的是这样对htm也要由asp.dll处理,效率将降低。

15.如何注册组件

答:有两种方法。

第一种方法:手工注册 DLL 这种方法从IIs 3.0一直使用到IIs 4.0和其它的Web Server。它需要你在命令行方式下来执行,进入到包含有DLL的目录,并输入:regsvr32 component_name.dll 例如 c:\temp\regsvr32 AspEmail.dll 它会把dll的特定信息注册入服务器中的注册表中。然后这个组件就可以在服务器上使用了,但是这个方法有一个缺陷。当使用这种方法注册完毕组件后,该组件必须要相应的设置NT的匿名帐号有权限执行这个dll。特别是一些组件需要读取注册表,所以,这个注册组件的方法仅仅是使用在服务器上没有MTS的情况下,要取消注册这个dll,使用:regsvr32 /u aspobject.dll example c:\temp\regsvr32 /u aneiodbc.dll

第二种方法:使用MTS(Microsoft Transaction Server) MTS是IIS 4新增特色,但是它提供了巨大的改进。MTS允许你指定只有有特权的用户才能够访问组件,大大提高了网站服务器上的安全性设置。在MTS上注册组件的步骤如下:

1) 打开IIS管理控制台。

2) 展开transaction server,右键单击"pkgs installed"然后选择"new package"。

3) 单击"create an empty package"。

4) 给该包命名。

5) 指定administrator帐号或则使用"interactive"(如果服务器经常是使用administrator 登陆的话)。

6) 现在使用右键单击你刚建立的那个包下面展开后的"components"。选择 "new then component"。

7) 选择 "install new component" 。

8) 找到你的.dll文件然后选择next到完成。

要删除这个对象,只要选择它的图标,然后选择delete。

附注:特别要注意第二种方法,它是用来调试自己编写组件的最好方法,而不必每次都需要重新启动机器了。

16. ASP与Access数据库连接:

<%@ language=VBs cript%>
<%
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
%>

17. ASP与SQL数据库连接:

<%@ language=VBs cript%>
<%
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

18. 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 …) 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 数据表名称 (永久性删除一个数据表)

19. 记录集对象的方法:

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 更新数据表记录

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

20. Recordset对象方法

Open方法

recordset.Open Source,ActiveConnection,CursorType,LockType,Options

Source

Recordset对象可以通过Source属性来连接Command对象。Source参数可以是一个Command对象名称、一段SQL命令、一个指定的数据表名称或是一个Stored Procedure。假如省略这个参数,系统则采用Recordset对象的Source属性。

ActiveConnection

Recordset对象可以通过ActiveConnection属性来连接Connection对象。这里的ActiveConnection可以是一个Connection对象或是一串包含数据库连接信息(ConnectionString)的字符串参数。

CursorType

Recordset对象Open方法的CursorType参数表示将以什么样的游标类型启动数据,包括adOpenForwardOnly、adOpenKeyset、adOpenDynamic及adOpenStatic,分述如下:

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

常数 常数值 说明

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

adOpenForwardOnly 0 缺省值,启动一个只能向前移动的游标(Forward Only)。

adOpenKeyset 1 启动一个Keyset类型的游标。

adOpenDynamic 2 启动一个Dynamic类型的游标。

adOpenStatic 3 启动一个Static类型的游标。

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

以上几个游标类型将直接影响到Recordset对象所有的属性和方法,以下列表说明他们之间的区别。

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

Recordset属性 adOpenForwardOnly adOpenKeyset adOpenDynamic adOpenStatic

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

AbsolutePage 不支持 不支持 可读写 可读写

AbsolutePosition 不支持 不支持 可读写 可读写

ActiveConnection 可读写 可读写 可读写 可读写

BOF 只读 只读 只读 只读

Bookmark 不支持 不支持 可读写 可读写

CacheSize 可读写 可读写 可读写 可读写

CursorLocation 可读写 可读写 可读写 可读写

CursorType 可读写 可读写 可读写 可读写

EditMode 只读 只读 只读 只读

EOF 只读 只读 只读 只读

Filter 可读写 可读写 可读写 可读写

LockType 可读写 可读写 可读写 可读写

MarshalOptions 可读写 可读写 可读写 可读写

MaxRecords 可读写 可读写 可读写 可读写

PageCount 不支持 不支持 只读 只读

PageSize 可读写 可读写 可读写 可读写

RecordCount 不支持 不支持 只读 只读

Source 可读写 可读写 可读写 可读写

State 只读 只读 只读 只读

Status 只读 只读 只读 只读

AddNew 支持 支持 支持 支持

CancelBatch 支持 支持 支持 支持

CancelUpdate 支持 支持 支持 支持

Clone 不支持 不支持

Close 支持 支持 支持 支持

Delete 支持 支持 支持 支持

GetRows 支持 支持 支持 支持

Move 不支持 支持 支持 支持

MoveFirst 支持 支持 支持 支持

MoveLast 不支持 支持 支持 支持

MoveNext 支持 支持 支持 支持

MovePrevious 不支持 支持 支持 支持

NextRecordset 支持 支持 支持 支持

Open 支持 支持 支持 支持

Requery 支持 支持 支持 支持

Resync 不支持 不支持 支持 支持

Supports 支持 支持 支持 支持

Update 支持 支持 支持 支持

UpdateBatch 支持 支持 支持 支持

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

其中NextRecordset方法并不适用于Microsoft Access数据库。

LockType

Recordset对象Open方法的LockType参数表示要采用的Lock类型,如果忽略这个参数,那么系统会以Recordset对象的LockType属性为预设值。LockType参数包含adLockReadOnly、adLockPrssimistic、adLockOptimistic及adLockBatchOptimistic等,分述如下:

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

常数 常数值 说明

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

adLockReadOnly 1 缺省值,Recordset对象以只读方式启动,无法运行AddNew、Update及Delete等方法

adLockPrssimistic 2 当数据源正在更新时,系统会暂时锁住其他用户的动作,以保持数据一致性。

adLockOptimistic 3 当数据源正在更新时,系统并不会锁住其他用户的动作,其他用户可以对数据进行增、删、改的操作。

adLockBatchOptimistic 4 当数据源正在更新时,其他用户必须将CursorLocation属性改为adUdeClientBatch才能对数据进行增、 删、改的操作。

内容来源:EX工作室-SEO资料站
浏览次数:51
陈一厢 发布于 2007-10-29
评论内容
1、  

  
   However, what we've experienced. 8GB MP3 PLAYER of LOTRO in the first two. buy wow gold dozen levels or so is extremely positive. buying gold world of warcraft The stunning visuals. cheap wow gold and the gorgeous realisation. cheap wow gold of a much-loved fantasy. cheap wow gold world are simply second. cheapest wow gold to none in this genre. eve isk the brilliant. mp3 storytelling and incredibly. mp3 player dramatic scripted. mp3 player events, equally, stand. mp3 players apart from the competition in every way. mp4 Once you look past the graphics. sell wow gold the writing and the artwork. world of warcraft gold you find that the beating. wow heart of Lord of the. wow gold Rings Online also. wow gold stands up to scrutiny. wow gold We've never come across. wow gold an MMOG which was quite. wow gold so polished and mature at. wow gold its launch as this one. wow gold kaufen the experience of. wow gold kaufen the team at Turbine. zubehoer mp3 player and their willingnes. 魔兽战争网游下载 to learn from both the triumphs. 战神不败网游下载 and the mistakes. of their competition, shines. through from.
  
游客 评论于 2008-12-9
2、  

   These achievements can. buy mp3 player also be unlocked by visiting. buy mp3 players certain places, killing. cheap mp3 player certain monsters. cheap mp3 players or just doing the right thing. eve isk The rewards vary. free online games from a paltry title. free online war games at the end of your name. gold wow to traits, which add. hdro gold depth to character customisation. lotro gold beyond simple gearing-up. lotro gold What's more, with a lot. mp3 player of these coming from character. mp3 players achievements, there's. mp4 player a lot of potential for diversity. online games Plus, with class boundaries. play war games being somewhat diverse, there's. portable mp3 players the ability to. wow ready yourself for. wow gold a lot of situations. wow gold Groups and guilds will. wow gold be pleased to know that. wow gold fellowships and kinships. wow leveling look easy to set up too, the latter. wow oro being a case of inviting whatever. wow powerleveling members you want, with no. limits to how many or.
  
游客 评论于 2008-12-9
3、  

  
   Outside of major changes. buy mp3 player like these, LOTRO offers pretty much. buy mp3 players everything you'd expect. cheap mp3 player from an MMORPG which. cheap mp3 players is being positioned as a. eve isk challenger to World of Warcraft. free online games Guilds (called Kinships), instanced. free online war games raids and duelling are all. gold wow built into the game, and. hdro gold Turbine has tried. lotro gold to balance out the proportion. lotro gold of instanced to shared-world content. mp3 player so that players don't. mp3 players spend too much time outside. mp4 player the main game world. online games Some key areas of LOTR. play war games are instanced, though - Weathertop, or Amon. portable mp3 players Sul, being one of them, with. wow an early instanced. wow gold quest where you need. wow gold to battle your way through. wow gold an orcish encampment to get to the top of the hill. wow gold There are ten crafting professions. wow leveling in the game, which work. wow oro in a manner similar to. wow powerleveling WOW - you collect. ingredients, acquire. a recipe, and make objects. in this manner.
  
游客 评论于 2008-12-9
4、  

   After playing in the. buy mp3 player beta for a few weeks, then, our hopes for. buy mp3 players Lord of the Rings. cheap mp3 player Online are surprisingly high. cheap mp3 players It would be an easy. eve isk game to dislike. free online games just on principle. free online war games a game which runs. gold wow riot with. hdro gold some elements of. lotro gold Tolkien's much-loved creation. lotro gold an MMORPG which seems. mp3 player set on challenging. mp3 players WoW purely on the basis. mp4 player of a popular license. online games However, the simple fact. play war games is that Turbine. portable mp3 players so far, seem to be doing. wow a damned good job. wow gold of pulling it all together. wow gold LOTRO won't make everyone. wow gold happy, but when Jeff. wow gold Steefel tells us that "if there's. wow leveling any game that can. wow oro take on WOW, this is it", we're. wow powerleveling inclined to believe him.
  
  
游客 评论于 2008-12-9
5、  

  
   逝去的初恋. 免费网络游戏 在伤感的年华里. 免费游戏 总觉得自己的情感太丰富啦. 免费游戏下载 那时总喜欢走在雨中,让雨水把自己包围. 魔兽 在那个小小的属于自己的空间. 网络游戏 中让思绪尽情放飞,让泪水在无声无息中滑落. 网游 让雨水把心中的痛冲淡. 游戏 让那一刻的无可奈何 age of conan 的痛感的愉悦成为永恒. 游戏下载 不想看到自己流泪不想用双手擦泪. 在线游戏 不想让别人看到自己流泪的狼狈样. 战神不败 我选择逃避. 最新免费网络游戏 雨水是我最好的面具. 最新网络游戏 其实我并没有真正的恋爱过. 最新网游 那个男孩被我拒绝了,但他后来却有了另一个女朋友. 最新游戏 于是,在那一刻,我孤高的心不再属于我的. 它在痛,痛得我无法控制. 有时我宁愿那颗心死掉算啦. 我不要它折磨我. 在这个世界上少了一个爱我的人. 而我却在那时悲哀的发现我的心已经是属于他的了. 爱情,真是缥缈的东西,来不及去考虑清楚.
  
游客 评论于 2008-12-9
签写评论
你的姓名:
评论主题:
支持UBB: 粗体 斜体 下划线 居中 超级连接 Email连接 插入图片 关闭上传图片 Flash图片 realplay视频文件 Media Player视频文件 飞行字 移动字 发光字
评论内容:
验 证 码:   看不清楚请点击换图
 
会员登陆
用户名  
密    码  
验证码      5200
登陆  |  注册会员
验证码无法显示,请下载修复!

广告推荐
CopyRight © 2007 一厢工作室旗下网站→EX工作室SEO资料站
版权所有 多放合作    E-mail:czx1372@163.com    交流群:23115093 粤ICP备06022088号