如何将存储过程值传递给webform?

时间:2013-10-17 10:48:19

标签: c# jquery asp.net sql

我更新鲜,我为我的sql表创建了一个存储过程,我想将这些数据显示到aspx页面中。

我需要..ajax,js,asp.net

的代码

1 个答案:

答案 0 :(得分:1)

从头顶像这样:

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...
                 }
            }
        }
    }
}
编辑:抱歉,错过了“检索”信息。