【发布时间】:2013-10-17 10:48:19
【问题描述】:
我比较新鲜,我为我的 sql 表创建了一个存储过程,我想将这些数据显示到一个 aspx 页面中..
我需要..ajax,js,asp.net 的代码
【问题讨论】:
-
已经用 Google 搜索过了?没找到文章?
-
我试了几次都没有得到确切的代码
-
我不会在这里提交此类问题,谢谢您的反馈..
我比较新鲜,我为我的 sql 表创建了一个存储过程,我想将这些数据显示到一个 aspx 页面中..
我需要..ajax,js,asp.net 的代码
【问题讨论】:
从我的头顶是这样的:
using (SqlConnection con = new SqlConnection(ConnectionString)) {
con.Open();
using (SqlCommand command = new SqlCommand("ProcedureName", con)) {
command.CommandType = CommandType.StoredProcedure;
using(SqlReader reader = command.ExecuteReader()){
if (reader.HasRows) {
while(reader.Read()) {
... process SqlReader objects...
}
}
}
}
}
编辑:抱歉,错过了“检索”信息。
【讨论】:
reader.HasRows。如果它没有行,则 reader.Read() 将返回 false 并且 while 循环将退出。