在看高手寫的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 執(zhí)行重復引用單個對象或結構的一系列語句。
參考地址: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://bwnwqq.cn/"
end with
response.write foraspcn.weburl
%>
更多信息請查看IT技術專欄