网站制作学习网ASP→正文:asp中with End with
字体:

asp中with End with

ASP 2010/7/7 15:12:59  点击:不统计

转载%77%77%77请%2E%66%6F%72%61%73%70%2E%63%6E注明
在看高手写的asp代码中看到asp代码用with来表示对象,其asp结构形式 with ...End with.
代码举例如下
<%
sql = "select * from table"
set rs = server.createObject("adodb.recordset")
with rs
.open sql,foraspcn,1,1
if .eof or .bof then
response.write "没有asp关于with end with 内容"
 .close
else
response.write "有相关asp中with end with的内容"
 .close
end if
end with
%>
上面是关于with 的一个例子.查询微软官方网站制作学习网
with ..end with 执行重复引用单个对象或结构的一系列语句。
参考地址:http://msdn.microsoft.com/zh-cn/library/wc500chb(VS.80).aspx
其实也很好理解with ..end with的意思
就是在下面的语句中省略了with 后参数.可以直接调用其.方法的形式
再次举例
<%
Class forasp'定义一个类
 Public webname
 Public weburl
End class
Set foraspcn = new forasp'设置foraspcn为一个对象
with foraspcn
.webname= "这里是网站制作学习网"
.weburl = "http://www.forasp.cn/"
end with
response.write foraspcn.weburl
%>
原载于:文章来源:www.forasp.cn网站制作学习

·上一篇:asp获取网络图片文件保存到本地 >>    ·下一篇:asp中readall和loadfromfile区别 >>
推荐文章
最新文章