最新下载
热门教程
- 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-27
- 真三国无双起源甄姬情谊解锁攻略 10-27
- 二重螺旋武器锻造材料获取攻略 10-27
- 星塔旅人紫瑾角色玩法介绍 10-27
- 逃离鸭科夫美味的秘密任务流程攻略 10-27
- 新月同行凡尔纳技能介绍一览 10-27