{"id":8431,"date":"2023-02-07T16:51:31","date_gmt":"2023-02-07T07:51:31","guid":{"rendered":"https:\/\/www.auctionpro.co.kr\/?p=8431"},"modified":"2023-02-07T16:53:22","modified_gmt":"2023-02-07T07:53:22","slug":"datatable-serialize-%ec%98%a4%eb%a5%98","status":"publish","type":"post","link":"https:\/\/www.auctionpro.co.kr\/?p=8431","title":{"rendered":"DataTable Serialize \uc624\ub958"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Overview : DataTable\uc744 serialize\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. DataTable \uc774\ub984\uc774 \uc124\uc815\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4 <br> DataSet \uacfc \ub2ec\ub9ac TableName \uc774\ub984\uc744 \ubc18\ub4dc\uc2dc \uc900\ub2e4.<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:vim decode:true \">System.InvalidOperationException: XML \ubb38\uc11c\ub97c \uc0dd\uc131\ud558\ub294 \ub3d9\uc548 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. ---&gt; System.InvalidOperationException: DataTable\uc744 serialize\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. DataTable \uc774\ub984\uc774 \uc124\uc815\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4.\n   \uc704\uce58: System.Data.DataTable.WriteXmlSchema(XmlWriter writer, Boolean writeHierarchy)\n   \uc704\uce58: System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter writer)\n   \uc704\uce58: System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)\n   \uc704\uce58: Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_DataTable(Object o)\n   \uc704\uce58: Microsoft.Xml.Serialization.GeneratedAssembly.DataTableSerializer.Serialize(Object objectToSerialize, XmlSerializationWriter writer)\n   \uc704\uce58: System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)\n   --- \ub0b4\ubd80 \uc608\uc678 \uc2a4\ud0dd \ucd94\uc801\uc758 \ub05d ---\n   \uc704\uce58: System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)\n   \uc704\uce58: System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)\n   \uc704\uce58: System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)\n   \uc704\uce58: System.Web.Services.Protocols.HttpServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)\n   \uc704\uce58: System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)\n   \uc704\uce58: System.Web.Services.Protocols.WebServiceHandler.Invoke()<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" title=\"TableName \" >ds.TableName = _key;  \/\/* \ubc18\ub4dc\uc2dc \uba85\uc2dc \ud55c\ub2e4.<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \">using System;\nusing System.Web;\nusing System.Data;\nusing System.Data.SqlClient;\n\nnamespace WebService1\n{\n    public class CacheClass\n    {\n        private static string _key = \"Customers\";\n\n        private static string connectionString = \"Data Source=localhost;\" + \"Initial Catalog=Northwind;user ID=sa\";\n\n        public static DataTable GetCustomerDataSet()\n        {\n            if (HttpContext.Current.Cache[_key] as DataTable == null)\n            {\n                \/\/ Recreate the item.             \n                string SQL = \"SELECT * FROM Customers\";\n                \/\/ Create ADO.NET objects.             \n                SqlConnection con = new SqlConnection(connectionString);\n                SqlCommand com = new SqlCommand(SQL, con);\n                SqlDataAdapter adapter = new SqlDataAdapter(com);\n\n                DataTable ds = new DataTable();\n                ds.TableName = _key;  \/\/* \ubc18\ub4dc\uc2dc \uba85\uc2dc \ud55c\ub2e4.\n\n                try\n                {\n                    con.Open();\n                    adapter.Fill(ds);\n                    HttpContext.Current.Cache.Insert(\"Customers\", ds, null, DateTime.Now.AddMinutes(60), TimeSpan.Zero);\n\n                }\n                catch (Exception err)\n                {\n                    System.Diagnostics.Debug.WriteLine(err.ToString());\n                }\n                finally\n                {\n                    con.Close();\n                }\n            }\n            return HttpContext.Current.Cache[_key] as DataTable;\n        }\n\n    }\n}<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Overview : DataTable\uc744 serialize\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. DataTable \uc774\ub984\uc774 \uc124\uc815\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4 DataSet \uacfc \ub2ec\ub9ac TableName \uc774\ub984\uc744 \ubc18\ub4dc\uc2dc \uc900\ub2e4.<\/p>\n<\/div>","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[237],"tags":[],"class_list":["post-8431","post","type-post","status-publish","format-standard","hentry","category-memory-cache"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DataTable Serialize \uc624\ub958 - AuctionPro<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.auctionpro.co.kr\/?p=8431\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DataTable Serialize \uc624\ub958 - AuctionPro\" \/>\n<meta property=\"og:description\" content=\"Overview : DataTable\uc744 serialize\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. DataTable \uc774\ub984\uc774 \uc124\uc815\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4 DataSet \uacfc \ub2ec\ub9ac TableName \uc774\ub984\uc744 \ubc18\ub4dc\uc2dc \uc900\ub2e4.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.auctionpro.co.kr\/?p=8431\" \/>\n<meta property=\"og:site_name\" content=\"AuctionPro\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-07T07:51:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-07T07:53:22+00:00\" \/>\n<meta name=\"author\" content=\"golgol\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"golgol\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=8431#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=8431\"},\"author\":{\"name\":\"golgol\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#\\\/schema\\\/person\\\/d3dbae599b06cd55f5b14a3e2116f7a2\"},\"headline\":\"DataTable Serialize \uc624\ub958\",\"datePublished\":\"2023-02-07T07:51:31+00:00\",\"dateModified\":\"2023-02-07T07:53:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=8431\"},\"wordCount\":8,\"commentCount\":0,\"articleSection\":[\"Memory Cache\"],\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=8431#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=8431\",\"url\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=8431\",\"name\":\"DataTable Serialize \uc624\ub958 - AuctionPro\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#website\"},\"datePublished\":\"2023-02-07T07:51:31+00:00\",\"dateModified\":\"2023-02-07T07:53:22+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#\\\/schema\\\/person\\\/d3dbae599b06cd55f5b14a3e2116f7a2\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=8431#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=8431\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?p=8431#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DataTable Serialize \uc624\ub958\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#website\",\"url\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/\",\"name\":\"AuctionPro\",\"description\":\"\uc625\uc158\ud504\ub85c\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/#\\\/schema\\\/person\\\/d3dbae599b06cd55f5b14a3e2116f7a2\",\"name\":\"golgol\",\"url\":\"https:\\\/\\\/www.auctionpro.co.kr\\\/?author=6\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DataTable Serialize \uc624\ub958 - AuctionPro","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.auctionpro.co.kr\/?p=8431","og_locale":"ko_KR","og_type":"article","og_title":"DataTable Serialize \uc624\ub958 - AuctionPro","og_description":"Overview : DataTable\uc744 serialize\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. DataTable \uc774\ub984\uc774 \uc124\uc815\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4 DataSet \uacfc \ub2ec\ub9ac TableName \uc774\ub984\uc744 \ubc18\ub4dc\uc2dc \uc900\ub2e4.","og_url":"https:\/\/www.auctionpro.co.kr\/?p=8431","og_site_name":"AuctionPro","article_published_time":"2023-02-07T07:51:31+00:00","article_modified_time":"2023-02-07T07:53:22+00:00","author":"golgol","twitter_card":"summary_large_image","twitter_misc":{"\uae00\uc4f4\uc774":"golgol","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"1\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.auctionpro.co.kr\/?p=8431#article","isPartOf":{"@id":"https:\/\/www.auctionpro.co.kr\/?p=8431"},"author":{"name":"golgol","@id":"https:\/\/www.auctionpro.co.kr\/#\/schema\/person\/d3dbae599b06cd55f5b14a3e2116f7a2"},"headline":"DataTable Serialize \uc624\ub958","datePublished":"2023-02-07T07:51:31+00:00","dateModified":"2023-02-07T07:53:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.auctionpro.co.kr\/?p=8431"},"wordCount":8,"commentCount":0,"articleSection":["Memory Cache"],"inLanguage":"ko-KR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.auctionpro.co.kr\/?p=8431#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.auctionpro.co.kr\/?p=8431","url":"https:\/\/www.auctionpro.co.kr\/?p=8431","name":"DataTable Serialize \uc624\ub958 - AuctionPro","isPartOf":{"@id":"https:\/\/www.auctionpro.co.kr\/#website"},"datePublished":"2023-02-07T07:51:31+00:00","dateModified":"2023-02-07T07:53:22+00:00","author":{"@id":"https:\/\/www.auctionpro.co.kr\/#\/schema\/person\/d3dbae599b06cd55f5b14a3e2116f7a2"},"breadcrumb":{"@id":"https:\/\/www.auctionpro.co.kr\/?p=8431#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.auctionpro.co.kr\/?p=8431"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.auctionpro.co.kr\/?p=8431#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/www.auctionpro.co.kr\/"},{"@type":"ListItem","position":2,"name":"DataTable Serialize \uc624\ub958"}]},{"@type":"WebSite","@id":"https:\/\/www.auctionpro.co.kr\/#website","url":"https:\/\/www.auctionpro.co.kr\/","name":"AuctionPro","description":"\uc625\uc158\ud504\ub85c","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.auctionpro.co.kr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Person","@id":"https:\/\/www.auctionpro.co.kr\/#\/schema\/person\/d3dbae599b06cd55f5b14a3e2116f7a2","name":"golgol","url":"https:\/\/www.auctionpro.co.kr\/?author=6"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8431"}],"version-history":[{"count":0,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/8431\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}