zoukankan
html css js c++ java
自适应输出表格(ASP版)
<
%
'
'
Made by Goodspeed
'
'
Option
Explicit
Response.Buffer
=
True
'
sql数据库连接参数:数据库名、用户密码、用户名、连接名(本地用local,外地用IP)
Const
SqlUsername
=
"
sa"
Const
SqlPassword
=
"
qwe"
Const
SqlDatabaseName
=
"
NorthWind"
Const
SqlLocalName
=
"
127.0.0.1"
Dim
ConnStr
ConnStr
=
"
Provider = Sqloledb; User ID =
"
&
SqlUsername
&
"
; Password =
"
&
SqlPassword
&
"
; Initial Catalog =
"
&
SqlDatabaseName
&
"
; Data Source =
"
&
SqlLocalName
&
"
;"
'
打开数据库
Dim
Conn
Set
Conn
=
server.
createobject
(
"
adodb.connection
"
)
Conn.Open ConnStr
%
>
<
html
>
<
head
>
<
title
>
ASP Test
</
title
>
<
meta http
-
equiv
=
"
Content-Type
"
content
=
"
text/html; charset=gb2312
"
>
</
head
>
<
body
>
<
table
>
<
%
Dim
rs, strSQL, Field, strResponse
strSQL
=
"
SELECT EmployeeID,LastName,FirstName FROM Employees;"
Set
rs
=
Conn.
Execute
(strSQL)
'
输出表头
strResponse
=
"
<tr>"
For
Each
Field In rs.Fields
strResponse
=
strResponse
&
"
<td>
"
&
Field.Name
&
"
</td>"
Next
strResponse
=
strResponse
&
"
</tr>"
'
输出表体
Do
Until rs.EOF
strResponse
=
strResponse
&
"
<tr>"
For
Each
Field In rs.Fields
strResponse
=
strResponse
&
"
<td>
"
&
rs(Field.Name)
&
"
</td>"
Next
strResponse
=
strResponse
&
"
</tr>"
rs.MoveNext
Loop
Set
rs
=
nothing
Response.Write (strResponse)
%
>
</
table
>
</
body
>
</
html
>
<
%
Conn.Close()
Set
Conn
=
nothing
%
>
查看全文
相关阅读:
成立移动互联网公司???
C++的子对象
单链表 操作的18种算法
再论虚函数
多线程(三)
多线程(二)
多线程(一)
存储过程的参数
git
多态(三)
原文地址:https://www.cnblogs.com/goodspeed/p/32675.html
最新文章
java.lang.IndexOutOfBoundException错误、通用Mapper插件 String index out of range: 0错误
css选择器有哪些
jq与js的区别
wps 设置标题样式 和 创建目录
UIActionSheet在iOS8中被弃用造成的错误
设置UILable特定的字为特定的颜色
iOS APNS推送前端和后端(Java)代码
【iOS 7】使用UIScreenEdgePanGestureRecognizer实现swipe to pop效果
欧美斯项目签到功能,实时获取当前所在位置的经纬度
用了Mj下拉刷新 An instance 0xca90200 of class UITableView was deallocated while key value observers were s
热门文章
Could not launch “PushTest.app”
工程跑真机出现的 [BEROR]CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.1'
iOS运行出现No application was specified.
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [160 nan]解决方法
C++中引用(&)的用法和应用实例
谈谈对O2O产品的一些看法(转载)
堆和栈的区别(转过无数次的文章)
产品经理如何编写页面流程图?
几个经典的字符串操作算法
C++静态成员函数小结(转)
Copyright © 2011-2022 走看看