{"id":2728,"date":"2018-05-30T13:14:53","date_gmt":"2018-05-30T11:14:53","guid":{"rendered":"http:\/\/www.capri-soft.de\/blog\/?p=2728"},"modified":"2018-05-30T13:16:01","modified_gmt":"2018-05-30T11:16:01","slug":"c-net-eine-geeignete-datenstruktur-fuer-tabellen-datatable-erstellen-best-net-datatype-for-tables","status":"publish","type":"post","link":"https:\/\/www.capri-soft.de\/blog\/?p=2728","title":{"rendered":"C# .NET Eine geeignete Datenstruktur f\u00fcr Tabellen \/  DataTable erstellen \/ Best .NET DataType for tables"},"content":{"rendered":"<h1>Problem<\/h1>\n<p>Die Datenstruktur DataTable von .NET muss richtig initialisiert wreden<\/p>\n<h1>L\u00f6sung<\/h1>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\npublic DataTable initDataGrid()\r\n{\r\n\tDataColumn c0 = new DataColumn(&quot;ID&quot;);\r\n\tDataColumn c1 = new DataColumn(&quot;FILE&quot;);\r\n\tDataColumn c2 = new DataColumn(&quot;SITE&quot;);\r\n\tDataColumn c3 = new DataColumn(&quot;OBJEKTSTEREOTYPE&quot;);\r\n\tDataColumn c4 = new DataColumn(&quot;TAB&quot;);\r\n\tDataColumn c5 = new DataColumn(&quot;STEREOTYPE&quot;);\r\n\tDataColumn c6 = new DataColumn(&quot;CONNECTION&quot;);\r\n\tDataColumn c7 = new DataColumn(&quot;LINK&quot;);\r\n\tDataColumn c8 = new DataColumn(&quot;LINK_TO_ID&quot;);\r\n\tDataColumn c9 = new DataColumn(&quot;ALIAS&quot;);\r\n\r\n\tdataTable.Columns.Add(c0);\r\n\tdataTable.Columns.Add(c8);\r\n\tdataTable.Columns.Add(c1);\r\n\tdataTable.Columns.Add(c2);\r\n\tdataTable.Columns.Add(c9);\r\n\tdataTable.Columns.Add(c3);\r\n\tdataTable.Columns.Add(c4);\r\n\tdataTable.Columns.Add(c5);\r\n\tdataTable.Columns.Add(c6);\r\n\tdataTable.Columns.Add(c7);\r\n\r\n\treturn dataTable;\r\n}\r\n\r\npublic void main()\r\n{\r\n    DataTable dataTable = new DataTable(&quot;Tabellenname&quot;);\r\n    dataTable.Clear(); \r\n\r\n    \/\/ Hier in einer Schleife die Tabelle bef\u00fcllen\r\n    \/\/ Use i.e. Loops to fill the table like this\r\n    DataRow row = dataTable.NewRow();\r\n    row&#x5B;&quot;ID&quot;] = &quot;1&quot;;\r\n    row&#x5B;&quot;FILE&quot;] = &quot;2&quot;;\r\n    row&#x5B;&quot;SITE&quot;] = &quot;3&quot;;\r\n    row&#x5B;&quot;OBJEKTSTEREOTYPE&quot;] = &quot;4&quot;;\r\n    row&#x5B;&quot;TAB&quot;] = &quot;5&quot;;\r\n    row&#x5B;&quot;STEREOTYPE&quot;] = &quot;6&quot;;\r\n    row&#x5B;&quot;CONNECTION&quot;] = &quot;7&quot;;\r\n    row&#x5B;&quot;LINK&quot;] = &quot;8&quot;;\r\n    row&#x5B;&quot;ALIAS&quot;] = &quot;9&quot;;\r\n    dataTable.Rows.Add(row);\r\n}\r\n<\/pre>\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=https%3A%2F%2Fwww.capri-soft.de%2Fblog%2F%3Fp%3D2728&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px;margin-top:5px;\"><\/iframe>","protected":false},"excerpt":{"rendered":"<p>Problem Die Datenstruktur DataTable von .NET muss richtig initialisiert wreden L\u00f6sung public DataTable initDataGrid() { DataColumn c0 = new DataColumn(&quot;ID&quot;); DataColumn c1 = new DataColumn(&quot;FILE&quot;); DataColumn c2 = new DataColumn(&quot;SITE&quot;); DataColumn c3 = new DataColumn(&quot;OBJEKTSTEREOTYPE&quot;); DataColumn c4 = new DataColumn(&quot;TAB&quot;); DataColumn c5 = new DataColumn(&quot;STEREOTYPE&quot;); DataColumn c6 = new DataColumn(&quot;CONNECTION&quot;); DataColumn c7 = new DataColumn(&quot;LINK&quot;); &hellip; <a href=\"https:\/\/www.capri-soft.de\/blog\/?p=2728\" class=\"more-link\"><span class=\"screen-reader-text\">C# .NET Eine geeignete Datenstruktur f\u00fcr Tabellen \/  DataTable erstellen \/ Best .NET DataType for tables<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"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_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,33,3],"tags":[],"class_list":["post-2728","post","type-post","status-publish","format-standard","hentry","category-net","category-c","category-programmierung"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4yGeN-I0","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2728"}],"version-history":[{"count":2,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2728\/revisions"}],"predecessor-version":[{"id":2730,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2728\/revisions\/2730"}],"wp:attachment":[{"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.capri-soft.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}