zoukankan
html css js c++ java
ASP和ASP.net中多结果集的返回
<
%
'
'
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, rs1,strSQL, Field, strResponse,cmd,rs2
Set
rs
=
Server.
CreateObject
(
"
ADODB.Recordset
"
)
'
建立记录集对象
Set
cmd
=
Server.
CreateObject
(
"
ADODB.Command
"
)
'
建立命令对象
set
cmd.ActiveConnection
=
Conn
cmd.CommandText
=
"
aaa"
cmd.CommandType
=
4
'
命令类别为4,表示为存储过程
set
rs
=
cmd.
execute
Do
Until rs
is
nothing
'
输出表头
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
=
rs.
NextRecordset
()
Loop
Set
rs
=
nothing
Response.Write (strResponse)
%
>
</
table
>
</
body
>
</
html
>
<
%
Conn.Close()
Set
Conn
=
nothing
%
>
<
script runat
=
"
server
"
>
void
Page_Load(
object
sender, EventArgs e)
{
System.Data.DataSet ds
=
SqlHelper.ExecuteDataSet(
"
aaa
"
);
GridView1.DataSource
=
ds.Tables[
1
];
GridView1.DataBind();
}
</
script
>
查看全文
相关阅读:
Android文件操作总结
SQLite优化方法
Android之TabHost布局
Android简单数据存储SharedPreferences
Android之SharedPreferences权限
Android布局大全
context理解
Android网络连接之HttpURLConnection和HttpClient
Android之ContentProvider总结
Intent的简介以及属性详解
原文地址:https://www.cnblogs.com/goodspeed/p/42632.html
最新文章
VS2010广告
步步为营VS 2008 + .NET 3.5系列文章索引(转自webabcd)
Javascript乱弹设计模式系列(2) - 抽象工厂以及工厂方法模式(Factory)
Javascript乱弹设计模式系列(6) - 单件模式(Singleton)
利用memcached构建高性能的Web应用程序(转)
利用asp.net日历服务器控件实现仿Yupoo日历相册的效果
数据库设计经验之谈(转载)
Javascript乱弹设计模式系列(4) - 组合模式(Composite)
jQuery.API源码深入剖析以及应用实现(1) - 核心函数篇
没有情人的情人节也要快乐!
热门文章
ASP.NET利用HttpHandler实现多扩展名文件下载
jQuery.API源码深入剖析以及应用实现(2) - jQuery对象访问和数据缓存
在ASP.Net中利用JS调用Aspx页面的输出
解密淘宝网的开源架构
基于GoogleMap,Mapabc,51ditu,VirtualEarth,YahooMap Api接口的Jquery插件的通用实现(含源代码下载)
Javascript乱弹设计模式系列(3) - 装饰者模式(Decorator)
C#版 Tag云图控件
Javascript乱弹设计模式系列(5) - 命令模式(Command)
Javascript乱弹设计模式系列(0) - 面向对象基础以及接口和继承类的实现
Javascript乱弹设计模式系列(1) - 观察者模式(Observer)
Copyright © 2011-2022 走看看