如何将存储过程值传递到 Web 窗体中

本文关键字:Web 窗体 值传 存储过程 | 更新日期: 2023-09-27 18:35:56

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

我需要代码..Ajax,JS,ASP.NET

如何将存储过程值传递到 Web 窗体中

从我的头顶上像这样:

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...
                 }
            }
        }
    }
}

编辑:抱歉,错过了"检索"信息。