最新下载
热门教程
- 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
% >
相关文章
- 洛克王国世界6大隐藏宠物怎么获得 完美宠物获取方法指南 03-28
- 126网易免费邮箱安全登录入口-126邮箱网页版双端畅连电脑手机 03-28
- 洛克王国世界渠道服与官服区别解析 洛克王国世界游戏内容与版本差异全介绍 03-28
- 红果短剧如何缓存视频 03-28
- 手机微博网页版官网入口-手机端微博官网网页版入口 03-28
- 红果短剧网页版无广告入口在哪 03-28