最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
将ASP代码移植为VB COM组件(4)
时间:2022-06-30 11:10:26 编辑:袖梨 来源:一聚教程网
                                            ASP页面
作 者 : 青苹果电脑工作室
这个例子中的第一站是ASP页。这个ASP页用ADO与Northwind 数据库连接。为了保持良好的编码习惯,我
使用了Option Explicit 并明确地声明了所有变量。这个ASP页的第一个草稿使用了内联代码。
'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
% >
New Page 1
Products
    
Product Name
Quantity Per Unitr
Price
    
Do until oRS.EOF
If x = 1 then
x = 0
% >
    
    
    
x = 1
end if
% >
        
        
        
    
oRS.MoveNext
Loop
% >
'Destroy objects
Set oRS = Nothing
Set oConn = Nothing
% >
                                        				                
                    
                        
                            
                        
                
                
            作 者 : 青苹果电脑工作室
这个例子中的第一站是ASP页。这个ASP页用ADO与Northwind 数据库连接。为了保持良好的编码习惯,我
使用了Option Explicit 并明确地声明了所有变量。这个ASP页的第一个草稿使用了内联代码。
'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
% >
New Page 1
Products
Product Name
Quantity Per Unitr
Price
Do until oRS.EOF
If x = 1 then
x = 0
% >
x = 1
end if
% >
oRS.MoveNext
Loop
% >
'Destroy objects
Set oRS = Nothing
Set oConn = Nothing
% >
相关文章
- 星塔旅人强化机在哪 强化机位置一览 10-31
- 星塔旅人等级怎么突破 等级突破方法 10-31
- 辉烬知世怎么配队 知世配队攻略 10-31
- 口袋斗罗大陆独孤博技能是什么 独孤博技能介绍一览 10-31
- 王者万象棋香香怎么玩 香香玩法介绍 10-31
- 王者万象棋阵容怎么搭配 阵容搭配攻略 10-31
 
             
                                 
                                 
                                 
                                 
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                         
                                            
                                        