国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 黄山市| 泽库县| 济源市| 财经| 宁蒗| 中西区| 延津县| 平江县| 汶川县| 报价| 南城县| 青龙| 木兰县| 乐平市| 泰顺县| 廊坊市| 阿坝县| 鄂托克旗| 阳谷县| 黎川县| 社旗县| 景洪市| 陕西省| 蒲江县| 建宁县| 广宁县| 二手房| 大港区| 观塘区| 乌拉特中旗| 潜江市| 松滋市| 安泽县| 兴安县| 沧州市| 张家川| 久治县| 怀化市| 武城县| 滦南县| 浦北县|