1、Controller中的方法代码如下:
由于方法中的存储过程没有带分页参数,所以还可以有继续优化的空间。
///
/// 获取测点列表
///
///
[HttpPost]
public JsonResult GetMeasurePointList(string TreeID, string TreeType, int sEcho, int iDisplayStart, int iDisplayLength)
{
DataTable dtResult = new DataTable();
string sql = string.Format("EXEC P_GET_ZXJG_TagList '{0}','{1}'", TreeID, TreeType);
dtResult = QuerySQL.GetDataTable(sql);
dtResult.Columns.Add("XuHao", typeof(string));
dtResult.Columns.Add("StrValueTime", typeof(string));
for (int i = 0; i < dtResult.Rows.Count; i++)
{
dtResult.Rows[i]["XuHao"] = (i + 1).ToString();
dtResult.Rows[i]["StrValueTime"] = Convert.ToDateTime(dtResult.Rows[i]["F_ValueTime"]).ToString("yyyy-