最新下载
热门教程
- 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
% >
相关文章
- 地狱即我们无人机怎么升级 模块安装与技能解锁指南 09-18
- 无主之地4圣城终点区玉米卷饼在哪 圣城终点区玉米卷饼收集攻略 09-18
- 禁闭求生2蝴蝶头箍怎么做 蝴蝶头箍制作攻略 09-18
- 我的休闲时光1月优家风尚新衣服有哪些-1月优家风尚新增服饰一览 09-18
- DNF手游女圣职怎么一天50级-女圣职一天50级速成攻略 09-18
- 魔兽世界莫高雷怎么去雷霆崖-莫高雷前往雷霆崖方法 09-18