最新下载
热门教程
- 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
% >
相关文章
- 163个人免费邮箱快捷登录入口-163免费邮箱安全验证通道 12-16
- 命运圣契命运回廊64层西风流打法 12-16
- 巨量百应官方登录入口-官网网址直达 12-16
- 山海进化录不同商店购买推荐 12-16
- 学信网官方登录入口-安全快捷的账号登录指引 12-16
- 青灯照鳞莲生与青玲儿获取攻略分享 12-16