国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > ASP > 正文

將ASP代碼移植為VB COM組件(轉(zhuǎn)4)

2024-05-04 11:06:35
字體:
供稿:網(wǎng)友
asp頁(yè)面
作 者 : 青蘋果電腦工作室                                    本文點(diǎn)擊次數(shù):351


     這個(gè)例子中的第一站是asp頁(yè)。這個(gè)asp頁(yè)用ado與northwind 數(shù)據(jù)庫(kù)連接。為了保持良好的編碼習(xí)慣,我
使用了option explicit 并明確地聲明了所有變量。這個(gè)asp頁(yè)的第一個(gè)草稿使用了內(nèi)聯(lián)代碼。

< % @ language=vbscript % >
< %
    'example of inline code
    option explicit
    
    'declare variables
    dim oconn
    dim ors
    dim connectionstring
    dim x
    
    connectionstring = "dsn=northwind;"
    
    set oconn = server.createobject("adodb.connection")
    oconn.open connectionstring
    
    set ors = server.createobject("adodb.recordset")
    
    'set variables
    ors.activeconnection = oconn
    ors.source = "select * from products"
    ors.open
% >
< html >
< head >
< meta http-equiv="content-type" content="text/html; charset=windows-1252" >
< title >new page 1< /title >
< /head >
< body >
< h1 >products< /h1 >
< table cellspacing="2" cellpadding="5" >
    < tr bgcolor="#ff6666" >
        < th >product name< /th >
        < th >quantity per unitr< /th >
        < th >price< /th >
    < /tr >
    < %
        do until ors.eof
            if x = 1 then
                x = 0
    % >
    < tr bgcolor="#ffcccc" >
    < % else % >
    < tr >
    < %
            x = 1
        end if
    % >
        < td >< %=ors("productname")% >< /td >
        < td >< %=ors("quantityperunit")% >< /td >
        < td >< %=ors("unitprice")% >< /td >
    < /tr >
    < %
            ors.movenext
        loop
    % >
< /table >
< /body >
< /html >
< %
    'destroy objects
    set ors = nothing
    set oconn = nothing
% >

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 保定市| 寻甸| 桂东县| 宁城县| 元江| 泽普县| 连州市| 凤城市| 新兴县| 蕉岭县| 桑日县| 平定县| 海安县| 安阳市| 田阳县| 蓝田县| 南岸区| 萍乡市| 沽源县| 平潭县| 中西区| 察哈| 梨树县| 沈丘县| 吉木乃县| 翁源县| 无极县| 富锦市| 泰来县| 南乐县| 庐江县| 巴林左旗| 明水县| 台中市| 蒲城县| 山西省| 全州县| 贵定县| 卓资县| 垣曲县| 东源县|