{"id":844,"date":"2009-03-31T21:59:24","date_gmt":"2009-03-31T12:59:24","guid":{"rendered":"http:\/\/gigasmegas.com\/?p=844"},"modified":"2009-04-15T04:41:03","modified_gmt":"2009-04-14T19:41:03","slug":"visual-basic-2008-%e3%81%a7-sqldatareader%e3%82%92%e5%a4%89%e6%95%b0%e6%96%87%e5%ad%97%e3%81%a7%e5%8f%82%e7%85%a7%e3%81%99%e3%82%8b%e8%a8%98%e8%bf%b0%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/gigasmegas.com\/?p=844","title":{"rendered":"VB.NET Tips SqlDataReader\u3092\u5909\u6570+\u6587\u5b57\u3067\u53c2\u7167\u3059\u308b\u8a18\u8ff0\u65b9\u6cd5"},"content":{"rendered":"<p><a onclick=\"javascript:pageTracker._trackPageview('\/outgoing\/rokuz.com\/?p=844');\"  href=\"http:\/\/rokuz.com\/?p=844\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/rokuz.com\/wp-content\/uploads\/2009\/03\/snag-0082-400x233.png\" alt=\"SqlDataReader\u3092\u5909\u6570+\u6587\u5b57\u3067\u53c2\u7167\u3059\u308b\u8a18\u8ff0\u65b9\u6cd5\" title=\"SqlDataReader\u3092\u5909\u6570+\u6587\u5b57\u3067\u53c2\u7167\u3059\u308b\u8a18\u8ff0\u65b9\u6cd5\" width=\"400\" height=\"233\" class=\"alignnone size-medium wp-image-845\" srcset=\"http:\/\/gigasmegas.com\/wp-content\/uploads\/2009\/03\/snag-0082-400x233.png 400w, http:\/\/gigasmegas.com\/wp-content\/uploads\/2009\/03\/snag-0082.png 497w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<address>photo by <a onclick=\"javascript:pageTracker._trackPageview('\/outgoing\/www.flickr.com\/photos\/3prins\/');\"  href=\"http:\/\/www.flickr.com\/photos\/3prins\/\">digi \/ Jeroen<\/a><\/address>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3057\u3001ExecuteReader\u3067SqlDataReader \u3078\u7d50\u679c\u3092\u8fd4\u3057Recordset\u306e\u5148\u982d\u304b\u30891\u884c\u3065\u3064\u8aad\u307f\u53d6\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u51e6\u7406\u306e\u904e\u7a0b\u3067\u3001\u666e\u901a\u306b\u5024\u3092\u5f97\u308b\u306b\u306f\u3001<\/p>\n<p><!--more--><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nDim RS As System.Data.SqlClient.SqlDataReader\r\nDim hCommand As System.Data.SqlClient.SqlCommand\r\n'\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u51e6\u7406\r\nCall C_ADO_Connect.ADO_Connect()\r\nhCommand.CommandText = &quot;SELECT * FROM hoge&quot;\r\nRS = hCommand.ExecuteReader()\r\nhCommand.Dispose()\r\nWhile (RS.Read())\r\n\r\n    'Hoge_name\u3078\u4ee3\u5165\u3000\u3053\u3053\u3067\u3059\uff01\r\n    Hoge_name = RS!hoge_name\r\n\r\nEnd While\r\nRS.Close()\r\n'\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5207\u65ad\u51e6\u7406\r\nCall C_ADO_Connect.ADO_Close()\r\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u201dRS!\u30c6\u30fc\u30d6\u30eb\u9805\u76ee\u540d\u201d\u3067\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p>\u30af\u30e9\u30b9\u306b\u30b3\u30fc\u30c9\u3092\u632f\u308a\u5206\u3051\u3066\u3001\u30af\u30e9\u30b9\u5074\u3067\u51e6\u7406\u3055\u305b\u305f\u3044\u6642\u3001\u30c6\u30fc\u30d6\u30eb\u540d\u3092\u30af\u30e9\u30b9\u5074\u306e\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u3078\u5f15\u6570\u3067\u6e21\u3057\u3001\u305d\u306e\u30c6\u30fc\u30d6\u30eb\u540d\u3092\u4f7f\u7528\u3057\u3066\u3001SqlDataReader\u304b\u3089\u30c6\u30fc\u30d6\u30eb\u540d+\u6587\u5b57\u3067\u53c2\u7167\u3059\u308b\u5834\u5408\u306f\u3001\u3069\u3046\u8a18\u8ff0\u3059\u308c\u3070\u826f\u3044\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nPublic Sub  db_insert(ByVal TableName As String)\r\n\r\nDim RS As System.Data.SqlClient.SqlDataReader\r\nDim hCommand As System.Data.SqlClient.SqlCommand\r\n\r\n'\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u51e6\u7406\r\nCall C_ADO_Connect.ADO_Connect()\r\nhCommand.CommandText = &quot;SELECT * FROM hoge&quot;\r\nRS = hCommand.ExecuteReader()\r\nhCommand.Dispose()\r\nWhile (RS.Read())\r\n\r\n    'Hoge_name\u3078\u4ee3\u5165\u3000\u3053\u3053\u3067\u3059\uff01\r\n    Hoge_name = RS(TableName &amp;amp;amp; &quot;_name&quot;)\r\n\r\nEnd While\r\nRS.Close()\r\n'\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5207\u65ad\u51e6\u7406\r\nCall C_ADO_Connect.ADO_Close()\r\n\r\nEnd Sub\r\n<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u201dRS!\uff5e\u201d\u3067\u306f\u306a\u304f\u3001\u201dRS(\uff5e)\u201d\u3067\u53c2\u7167\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305f\u307e\u306b\u3001\u8a18\u8ff0\u65b9\u6cd5\u3092\u5fd8\u308c\u3061\u3083\u3046\u3093\u3067\u3059\u3088\u306d\u2026\u2026<\/p>\n","protected":false},"excerpt":{"rendered":"<p>photo by digi \/ Jeroen \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3057\u3001ExecuteReader\u3067SqlDataReader \u3078\u7d50\u679c\u3092\u8fd4\u3057Recordset\u306e\u5148\u982d\u304b\u30891\u884c\u3065\u3064\u8aad\u307f\u53d6\u308a\u307e\u3059\u3002 \u3053\u306e\u51e6\u7406\u306e\u904e\u7a0b\u3067\u3001\u666e\u901a\u306b\u5024\u3092\u5f97\u308b [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,303,19,25,32,15],"tags":[306,272,308,250,254,304,307],"class_list":["post-844","post","type-post","status-publish","format-standard","hentry","category-sqlserver","category-vbnet","category-wordpress","category-computer","category-database","category-movie","tag-net","tag-272","tag-basic","tag-sql","tag-tips","tag-vb","tag-visual"],"_links":{"self":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts\/844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=844"}],"version-history":[{"count":10,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":1017,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions\/1017"}],"wp:attachment":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}