{"id":25,"date":"2014-05-21T01:47:00","date_gmt":"2014-05-20T16:47:00","guid":{"rendered":"http:\/\/the-takeo.expressweb.jp\/?p=25"},"modified":"2015-10-31T15:33:49","modified_gmt":"2015-10-31T06:33:49","slug":"datatable%e3%81%ae%e7%89%b9%e5%ae%9a%e3%81%ae%e8%a1%8c%e3%82%92%e5%88%a5%e3%81%aedatatable%e3%81%ab%e6%a0%bc%e7%b4%8d%e3%81%99%e3%82%8b%e3%80%82","status":"publish","type":"post","link":"http:\/\/the-takeo.com\/?p=25","title":{"rendered":"DataTable\u306e\u7279\u5b9a\u306e\u884c\u3092\u5225\u306eDataTable\u306b\u683c\u7d0d\u3059\u308b\u3002"},"content":{"rendered":"<p>\u300cDataTable\u306e\u3042\u308b\u7279\u5b9a\u306e\u884c\u3092\u62bd\u51fa\u3057\u3001\u305d\u306e\u7d50\u679c\u3092\u683c\u7d0d\u3057\u305fDataTable\u3092\u4f5c\u308b\u300d\u3068\u3044\u3046\u64cd\u4f5c\u304c\u5fc5\u8981\u306b\u306a\u3063\u305f\u3002<\/p>\n<div>\u4f55\u3082\u60a9\u3080\u6240\u306f\u7121\u3044\u3068\u601d\u3063\u305f\u306e\u3060\u304c\u3001\u610f\u5916\u3068\u4f55\u56de\u3082\u5931\u6557\u3057\u3001\u6700\u7d42\u7684\u306b\u30ab\u30f3\u30cb\u30f3\u30b0\u3092\u3057\u305f\u306e\u3067\u3001\u5099\u5fd8\u9332\u3068\u3057\u3066\u66f8\u304d\u8a18\u3059\u3002<\/div>\n<pre class=\"lang:c# decode:true \" >\/\/\u3053\u3053\u304b\u3089DataTable\u3092\u4f5c\u6210\u3057\u3066\u308b\u3060\u3051\r\nDataTable dt = new DataTable();\r\ndt.Columns.Add(\"col1\");\r\ndt.Columns.Add(\"col2\");\r\ndt.PrimaryKey = new DataColumn[] { dt.Columns[0] };\r\n\r\nfor (int i = 0; i &amp;lt; 10; i++)\r\n{\r\n    DataRow dr = dt.NewRow();\r\n    dr[\"col1\"] = i.ToString();\r\n    dr[\"col2\"] = i.ToString()+\"\u56de\u76ee\u306b\u8ffd\u52a0\u3055\u308c\u305f\u884c\u3067\u3059\u3002\";\r\n    dt.Rows.Add(dr);\r\n}\r\n\/\/\u3053\u3053\u307e\u3067DataTable\u3092\u4f5c\u6210\u3057\u3066\u3044\u308b\u3060\u3051\r\n\r\n\/\/Select\u3067\u62bd\u51fa\u3057\u305f\u7d50\u679c\u3092\u65b0\u3057\u3044DataTable\u3068\u3057\u3066\u683c\u7d0d\u3057\u305f\u3044\u3002\r\nDataRow[] drs = dt.Select(\"col1='3' or col1='5'\");\r\n\r\nDataTable newdt = dt.Clone();\r\n\r\nforeach (var dr in drs)\r\n{\r\n    \/\/newdt.Rows.Add(dr)\u3067\u306f\u30c0\u30e1\u3002\r\n    \/\/dr\u306fdt\u306b\u6240\u5c5e\u3057\u3066\u3044\u308b\u884c\u306a\u306e\u3067\u3001\u5225\u306eDataTable\u3067\u3042\u308bnewdt\u306b\u306fAdd\u3067\u304d\u306a\u3044\u3002\r\n    \/\/\u3088\u3063\u3066\u3001newdt\u306e\u65b0\u3057\u3044\u884c\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u5404\u5217\u306e\u5024\u3092dr\u3068\u5168\u304f\u540c\u3058\u306b\u3057\u3001\u305d\u308c\u3092newdt\u306b\u8ffd\u52a0\u3059\u308c\u3070\u826f\u3044\u3002\r\n    DataRow newrow = newdt.NewRow();\r\n    newrow.ItemArray = dr.ItemArray;\r\n    newdt.Rows.Add(newrow);\r\n}<\/pre>\n<p>\u3064\u307e\u308a\u3001DataRow\u306fDataTable\u306b\u6240\u5c5e\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u306e\u3067\u3001<br \/>\n\u9055\u3046DataTable\u306b\u8ffd\u52a0\u3059\u308b\u306b\u306f\u5168\u304f\u65b0\u3057\u3044\u884c\u3092\u4f5c\u6210\u3057\u3066\u8ffd\u52a0\u3057\u306a\u304f\u3066\u306f\u3044\u3051\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3002<\/p>\n<p>\u3082\u3063\u3068\u30b9\u30de\u30fc\u30c8\u306b\u3067\u304d\u306a\u3044\u306e\u304b\u306a\u3002<br \/>\n\u308f\u3056\u308f\u3056Select\u3057\u305f\u3082\u306e\u3092\u3055\u3089\u306bDataTable\u306b\u3059\u308b\u3068\u3044\u3046\u306e\u304c\u305d\u3082\u305d\u3082\u30b9\u30de\u30fc\u30c8\u3058\u3083\u306a\u3044\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300cDataTable\u306e\u3042\u308b\u7279\u5b9a\u306e\u884c\u3092\u62bd\u51fa\u3057\u3001\u305d\u306e\u7d50\u679c\u3092\u683c\u7d0d\u3057\u305fDataTable\u3092\u4f5c\u308b\u300d\u3068\u3044\u3046\u64cd\u4f5c\u304c\u5fc5\u8981\u306b\u306a\u3063\u305f\u3002 \u4f55\u3082\u60a9\u3080\u6240\u306f\u7121\u3044\u3068\u601d\u3063\u305f\u306e\u3060\u304c\u3001\u610f\u5916\u3068\u4f55\u56de\u3082\u5931\u6557\u3057\u3001\u6700\u7d42\u7684\u306b\u30ab\u30f3\u30cb\u30f3\u30b0\u3092\u3057\u305f\u306e\u3067\u3001\u5099\u5fd8\u9332\u3068\u3057\u3066\u66f8\u304d\u8a18\u3059\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,4],"tags":[],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-c","category-programming"],"_links":{"self":[{"href":"http:\/\/the-takeo.com\/index.php?rest_route=\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/the-takeo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/the-takeo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/the-takeo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/the-takeo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=25"}],"version-history":[{"count":4,"href":"http:\/\/the-takeo.com\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":471,"href":"http:\/\/the-takeo.com\/index.php?rest_route=\/wp\/v2\/posts\/25\/revisions\/471"}],"wp:attachment":[{"href":"http:\/\/the-takeo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/the-takeo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/the-takeo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}