一些杂乱的总结

C#里datatable数据拆分

>>>>每5000条建立一张表>>>>
 DataSet dtm= new DataSet();
 var dtm_length = dtm.Tables[0].Rows.Count / 5000;
List list = new List();
for (int i = 0; i < dtm_length; i++)
   {
      DataTable dtm_new = new DataTable();
      dtm_new = dtm.Tables[0].AsEnumerable().Skip(i * 5000).Take(5000).CopyToDataTable().Copy();
       dtm_new.TableName = "sw_CGFP_b";
       list.Add(dtm_new);
   }
>>>>剩余不足5000条的建立一张表>>>>
DataTable dtm_new1 = new DataTable();
dtm_new1 = dtm.Tables[0].AsEnumerable().Skip(dtm_length * 5000).Take(dtm.Tables[0].Rows.Count - dtm_length * 5000).CopyToDataTable().Copy();
dtm_new1.TableName = "sw_CGFP_b";
list.Add(dtm_new1);
string [] dtm_list =new string [list.Count];
for (var i = 0; i < list.Count; i++)
 {
    dtm_list[i] = JEDConvertTools.ObjectToJson(list[i]);
                    
 }

动态添加option

var field_input = $("#stock_id");//得到元素节点
$(field_input).html("");//清空原来内容
$("#stock_id option").remove();
$("#stock_id").append("");
 $.each(data, function (key, value) {
     if (data[key].stock_id != null && data[key].stock_name != "") {
         $("#stock_id").append("");
//添加新内容
                 }
  });

重画

 int line1 = cb_count - 4 > 0 ? 4 : cb_count;
 int line2 = cb_count - 4 > 0 ? cb_count : 0;  
    @for (int i = 0; i < line1; i++) {
  • @Model.class_basic[i].pp_name

    @Model.class_basic[i].note
  • }
    @if (line2 != 0) { for (int i = 4; i < line2; i++) {
  • @Model.class_basic[i].pp_name

    @Model.class_basic[i].note
  • } }

关闭页面


数组

var zgbhArr = [];
zgbhArr.push(data.zgbh, data.zgxm)

对象

var obj = {};
obj[data.zgbh] = data.zgxm;

后台正则

  string pattern = @"^[a-zA-Z]+$";
            Regex regex = new Regex(pattern);
            if (regex.IsMatch(dr["loc_id"].ToString().Substring(0, 1)))
            {
                dr.Delete();
            }

你可能感兴趣的:(一些杂乱的总结)