前台发送字符串给后台,格式为(a,b,c,d),后台将字符串转换成数组遍历后进而更新CheckId

 using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TL.Common.Util; namespace S_manager
{
public partial class S_GetCheckMater : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string matterId = Request.Params["matterid"];
char[] chs = { ',' };
try
{
string[] str = matterId.Split(chs, StringSplitOptions.RemoveEmptyEntries);
string strcnn = ConfigurationManager.ConnectionStrings["conn"].ToString();
SQLHelper sqlHelper = new SQLHelper(strcnn);
for (int i = ; i < str.Length; i++)
{ //更新数据库的CheckId
string sql = "update growup.dbo.S_Matter set CheckId='1' where S_MatterId ='" + str[i] + "'";
DataSet ds_result = sqlHelper.QueryByCmd(sql);
//格式化查询结果
string json = JsonConvert.SerializeObject(ds_result);
//返回给前端
Response.Write(json);
}
}
catch { } }
}
}
上一篇:[Java Collection]List分组之简单应用.


下一篇:2020年最新78道JVM面试题总结(含答案解析和思维导图)