zoukankan      html  css  js  c++  java
  • 前台发送字符串给后台,格式为(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 }
  • 相关阅读:
    hdu4734 F(x)
    hdu2089 不要62 两解
    luogu2602 [ZJOI2010]数字计数 两解
    lemon
    UVA1218 完美的服务 Perfect Service
    luogu HNOI2003消防局的设立
    uva10891 game of sum
    uva10635 Prince and Princess
    UVA1394 And Then There Was One
    uva10003切木棍
  • 原文地址:https://www.cnblogs.com/laresh/p/4988198.html
Copyright © 2011-2022 走看看