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

首頁 > 編程 > ASP > 正文

將ASP代碼移植為VB COM組件-4

2019-11-18 22:18:23
字體:
供稿:網(wǎng)友
這個例子中的第一站是asp頁。這個ASP頁用ADO與Northwind 數(shù)據(jù)庫連接。為了保持良好的編碼習慣,我
使用了Option Explicit 并明確地聲明了所有變量。這個ASP頁的第一個草稿使用了內(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ā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 武宁县| 定州市| 惠安县| 杭锦后旗| 宁陕县| 陕西省| 平凉市| 县级市| 财经| 昌平区| 和林格尔县| 都昌县| 馆陶县| 神木县| 五华县| 柳州市| 台东县| 保靖县| 临朐县| 横山县| 博客| 扎兰屯市| 高青县| 达尔| 台中县| 化隆| 乌苏市| 安塞县| 阿克苏市| 新绛县| 景宁| 新营市| 惠州市| 施秉县| 兴义市| 金湖县| 余干县| 金堂县| 盐津县| 奎屯市| 商水县|