在看高手寫(xiě)的asp代碼中看到asp代碼用with來(lái)表示對(duì)象,其asp結(jié)構(gòu)形式 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 "沒(méi)有asp關(guān)于with end with 內(nèi)容"
.close
else
response.write "有相關(guān)asp中with end with的內(nèi)容"
.close
end if
end with
%>
上面是關(guān)于with 的一個(gè)例子.查詢微軟官方網(wǎng)站制作學(xué)習(xí)網(wǎng)
with ..end with 執(zhí)行重復(fù)引用單個(gè)對(duì)象或結(jié)構(gòu)的一系列語(yǔ)句。
參考地址:http://msdn.microsoft.com/zh-cn/library/wc500chb(VS.80).aspx
其實(shí)也很好理解with ..end with的意思
就是在下面的語(yǔ)句中省略了with 后參數(shù).可以直接調(diào)用其.方法的形式
再次舉例
<%
Class forasp'定義一個(gè)類
Public webname
Public weburl
End class
Set foraspcn = new forasp'設(shè)置foraspcn為一個(gè)對(duì)象
with foraspcn
.webname= "這里是網(wǎng)站制作學(xué)習(xí)網(wǎng)"
.weburl = "http://bwnwqq.cn/"
end with
response.write foraspcn.weburl
%>
更多信息請(qǐng)查看IT技術(shù)專欄