{"id":5963,"date":"2019-01-18T15:14:21","date_gmt":"2019-01-18T06:14:21","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=5963"},"modified":"2020-05-28T13:05:20","modified_gmt":"2020-05-28T04:05:20","slug":"c%ec%97%90%ec%84%9c-postgresql-%ec%82%ac%ec%9a%a9%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=5963","title":{"rendered":"C#\uc5d0\uc11c PostgreSQL \uc0ac\uc6a9\ud558\uae30"},"content":{"rendered":"<p>C# \uc5b8\uc5b4\uc5d0\uc11c PostgreSQL \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub97c \uc0ac\uc6a9\ud558\uae30 \uc704\ud55c \ub0b4\uc6a9\uc744 \uc815\ub9ac\ud574 \ubd05\ub2c8\ub2e4.<\/p>\n<p>\uba3c\uc800 Visual Studio\ub97c \uc2e4\ud589\ud558\uace0 C# \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4. \uadf8\ub9ac\uace0 Package Manager\ub97c \uc2e4\ud589\ud558\ub294\ub370, \uc544\ub798\uc640 \uac19\uc740 \uba54\ub274\ub97c \ud1b5\ud574 \uc811\uadfc\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"659\" height=\"434\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2019\/01\/PM.png\" class=\"aligncenter size-full wp-image-5964\" \/><\/p>\n<p>Package Manager\ub294 \ucf58\uc194\ucc3d\uacfc \ube44\uc2b7\ud55c \ubc29\uc2dd\uc73c\ub85c \uba85\ub839\uc744 \uc2e4\ud589\ud560 \uc218 \uc788\ub294\ub370, .NET\uc744 \uc704\ud55c PostgreSQL \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc124\uce58\ud558\uae30 \uc704\ud574 \uc544\ub798\uc758 \uba85\ub839\uc744 \uc785\ub825\ud569\ub2c8\ub2e4.<\/p>\n<p><code>Install-Package Npgsql -Version 4.0.4<\/code><\/p>\n<p>\ud604\uc7ac \uc2dc\uc810\uc5d0\uc11c\ub294 4.0.4\uac00 \ucd5c\uc2e0\ubc84\uc804\uc774\uc9c0\ub9cc \uc774\ub97c \ud655\uc778\ud558\uae30 \uc704\ud574 \uc544\ub798\uc758 URL\ub85c \uc811\uc18d\ud558\uae30 \ubc14\ub78d\ub2c8\ub2e4.<\/p>\n<p><code>https:\/\/www.nuget.org\/packages\/Npgsql\/<\/code><\/p>\n<p>\ub77c\uc774\ube0c\ub7ec\ub9ac\uc758 \uc124\uce58\uac00 \uc131\uacf5\uc801\uc73c\ub85c \ub9c8\ubb34\ub9ac \ub418\uba74 \uc544\ub798\ucc98\ub7fc \ucf54\ub4dc\ub97c \uc785\ub825\ud558\uc5ec PostgreSQL\uc5d0 \ub300\ud55c \uc870\ud68c\uac00 \uac00\ub2a5\ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">\r\nusing (var conn = new NpgsqlConnection(\"host=localhost;username=postgres;password=__________;database=postgres\"))\r\n{\r\n    try\r\n    {\r\n        conn.Open();\r\n        using (var cmd = new NpgsqlCommand())\r\n        {\r\n            cmd.Connection = conn;\r\n\r\n            cmd.CommandText = \r\n                \"SELECT table_name \" +\r\n                \"FROM information_schema.tables \" + \"\" +\r\n                \"WHERE table_schema = 'public' AND table_type = 'BASE TABLE'\";\r\n\r\n\r\n            using (var reader = cmd.ExecuteReader())\r\n            {\r\n                while (reader.Read())\r\n                {\r\n                    listBox1.Items.Add(reader.GetString(0));\r\n                    \/\/or listBox1.Items.Add(reader[\"table_name\"].ToString());\r\n                }\r\n            }\r\n        }\r\n    }\r\n    catch (Exception ex)\r\n    {\r\n        MessageBox.Show(ex.ToString());\r\n    }\r\n}\r\n<\/pre>\n<p>Using \uc808\uc5d0 \ucd94\uac00\ud574\uc57c \ud560 \uac83\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<p><code>using Npgsql;<\/code><\/p>\n<p>\ub05d\uc73c\ub85c Npgsql\uc740 \ud558\ub098\uc758 Connection\uc5d0 \ub300\ud574\uc11c \ud558\ub098\uc758 Command\ub9cc\uc744 \uc2e4\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ud655\uc778\ud55c \ub0a0\uc9dc\ub294 2019\ub144 10\uc6d4 2\uc77c\uc790\uc774\uba70, \uc774 \uc2dc\uc810\uc5d0\uc11c \ucd5c\uc2e0 \ubc84\uc804\uc73c\ub85c \ud14c\uc2a4\ud2b8\ud574 \ubcf4\uc558\uc2b5\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C# \uc5b8\uc5b4\uc5d0\uc11c PostgreSQL \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub97c \uc0ac\uc6a9\ud558\uae30 \uc704\ud55c \ub0b4\uc6a9\uc744 \uc815\ub9ac\ud574 \ubd05\ub2c8\ub2e4. \uba3c\uc800 Visual Studio\ub97c \uc2e4\ud589\ud558\uace0 C# \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4. \uadf8\ub9ac\uace0 Package Manager\ub97c \uc2e4\ud589\ud558\ub294\ub370, \uc544\ub798\uc640 \uac19\uc740 \uba54\ub274\ub97c \ud1b5\ud574 \uc811\uadfc\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4. Package Manager\ub294 \ucf58\uc194\ucc3d\uacfc \ube44\uc2b7\ud55c \ubc29\uc2dd\uc73c\ub85c \uba85\ub839\uc744 \uc2e4\ud589\ud560 \uc218 \uc788\ub294\ub370, .NET\uc744 \uc704\ud55c PostgreSQL \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc124\uce58\ud558\uae30 \uc704\ud574 \uc544\ub798\uc758 \uba85\ub839\uc744 \uc785\ub825\ud569\ub2c8\ub2e4. Install-Package Npgsql -Version 4.0.4 \ud604\uc7ac \uc2dc\uc810\uc5d0\uc11c\ub294 4.0.4\uac00 \ucd5c\uc2e0\ubc84\uc804\uc774\uc9c0\ub9cc \uc774\ub97c \ud655\uc778\ud558\uae30 \uc704\ud574 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=5963\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;C#\uc5d0\uc11c PostgreSQL \uc0ac\uc6a9\ud558\uae30&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118],"tags":[],"class_list":["post-5963","post","type-post","status-publish","format-standard","hentry","category-csharp"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/5963","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5963"}],"version-history":[{"count":8,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/5963\/revisions"}],"predecessor-version":[{"id":9549,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/5963\/revisions\/9549"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5963"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}