Fork me on GitHub

青禹小生

雁驰万里却作禽,鱼未得水空有鳞。 花开花落花不语,昨是昨非昨亦今。

导航

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

 1 using Newtonsoft.Json;
 2 using System;
 3 using System.Collections.Generic;
 4 using System.Configuration;
 5 using System.Data;
 6 using System.Linq;
 7 using System.Web;
 8 using System.Web.UI;
 9 using System.Web.UI.WebControls;
10 using TL.Common.Util;
11 
12 namespace S_manager
13 {
14     public partial class S_GetCheckMater : System.Web.UI.Page
15     {
16         protected void Page_Load(object sender, EventArgs e)
17         {
18             string matterId = Request.Params["matterid"];
19             char[] chs = { ',' };
20             try
21             {
22                 string[] str = matterId.Split(chs, StringSplitOptions.RemoveEmptyEntries);
23                 string strcnn = ConfigurationManager.ConnectionStrings["conn"].ToString();
24                 SQLHelper sqlHelper = new SQLHelper(strcnn);
25                 for (int i = 0; i < str.Length; i++)
26                 {
27 
28        
29                         //更新数据库的CheckId
30                         string sql = "update growup.dbo.S_Matter set CheckId='1' where S_MatterId ='" + str[i] + "'";
31                         DataSet ds_result = sqlHelper.QueryByCmd(sql);
32                         //格式化查询结果
33                         string json = JsonConvert.SerializeObject(ds_result);
34                         //返回给前端
35                         Response.Write(json);
36                 }
37             }
38             catch { }
39 
40         }
41     }
42 }

 

posted on 2015-11-23 13:34  司徒道  阅读(586)  评论(0编辑  收藏  举报