{"id":6097,"date":"2017-09-05T12:54:31","date_gmt":"2017-09-05T03:54:31","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=6097"},"modified":"2017-09-05T12:54:31","modified_gmt":"2017-09-05T03:54:31","slug":"adofieldscollection","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/adofieldscollection\/","title":{"rendered":"\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\uff08ADO\uff09Fields \u30b3\u30ec\u30af\u30b7\u30e7\u30f3"},"content":{"rendered":"<h2>Fields \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/h2>\n<div class=\"m30-l\">\n<p><strong>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u5185\u306e\uff11\u3064\u4ee5\u4e0a\u306e\u5217\uff08\u30d5\u30a3\u30fc\u30eb\u30c9\uff09\u3092\u8868\u3059\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08<strong>Field \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\uff09\u3067\u69cb\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u5404 <strong>Field \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong> \u306b\u95a2\u3057\u3066\u306e\u8a73\u7d30\u306f\u3001<a href=\"https:\/\/excelwork.info\/excel\/adofieldobject\/\">\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\uff08ADO\uff09Field \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/a> \u3092\u53c2\u7167\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<br \/>\n<h3>Count \u30d7\u30ed\u30d1\u30c6\u30a3<\/h3>\n<p><strong>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u5185\u306e <strong>Fields \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/strong>\u304c\u6301\u3064 <strong>Field \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e\u6570\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <em>object<\/em>.<strong>Fields<\/strong>.<strong>Count<\/strong><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>\u623b\u308a\u5024&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<strong>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u5185\u306e\u5217\u6570\u3092\u8fd4\u3057\u307e\u3059\u3002<\/li>\n<\/ul><\/div>\n<br \/>\n<h3>Item \u30d7\u30ed\u30d1\u30c6\u30a3<\/h3>\n<p><strong>Field \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <em>object<\/em>.<strong>Fields<\/strong>[.<strong>Item<\/strong>](<em>index<\/em>)<br \/>\n    <em>object<\/em>.<strong>Fields<\/strong>[.<strong>Item<\/strong>](&#8220;<em>name<\/em>&#8220;)<br \/>\n    <em>object<\/em>(<em>index<\/em>)<br \/>\n    <em>object<\/em>(&#8220;<em>name<\/em>&#8220;)<br \/>\n    <em>object<\/em>![<em>name<\/em>]<\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul><\/div>\n<\/div>\n<br \/><br \/>\n<h2>Fields \u30b3\u30ec\u30af\u30b7\u30e7\u30f3 \u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"Fields \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_ADO_FieldsConnection()\r\n     \r\n    '\u53c2\u7167\u8a2d\u5b9a\r\n    'Microsoft ActiveX Data Objects 6.1 Library\r\n\r\n    Dim cn As New ADODB.Connection\r\n    Dim rs As New ADODB.Recordset\r\n    Dim constr As String\r\n    Dim DBFile As String\r\n    Dim strSQL As String\r\n    \r\n    DBFile = ActiveWorkbook.Path & \"\\mydb1.accdb\"\r\n    constr = \"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\" & DBFile\r\n    \r\n    cn.ConnectionString = constr\r\n    cn.Open\r\n    \r\n    strSQL = \"Select * from \u793e\u54e1\u540d\u7c3f;\"\r\n    rs.Source = strSQL\r\n    rs.ActiveConnection = cn\r\n    \r\n    MsgBox \"\u30d5\u30a3\u30fc\u30eb\u30c9\u6570\uff1a\" & rs.Fields.Count\r\n    \r\n    Set rs = Nothing\r\n    cn.Close\r\n    Set cn = Nothing\r\n    \r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adofieldsconnection_01.jpg?ssl=1\" rel=\"lightbox[6097]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adofieldsconnection_01.jpg?resize=457%2C338&#038;ssl=1\" alt=\"ADO Fields \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\" width=\"457\" height=\"338\" class=\"alignnone size-full wp-image-6099\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adofieldsconnection_01.jpg?w=457&amp;ssl=1 457w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adofieldsconnection_01.jpg?resize=400%2C296&amp;ssl=1 400w\" sizes=\"(max-width: 457px) 100vw, 457px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>Fields \u30b3\u30ec\u30af\u30b7\u30e7\u30f3 Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u5185\u306e\uff11\u3064\u4ee5\u4e0a\u306e\u5217\uff08\u30d5 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":6099,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[948],"tags":[953,950,472,721,968,974,975,981,970,952,951,814,955,949,835],"jetpack_featured_media_url":"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/07\/adofieldsconnection_01.jpg?fit=457%2C338&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1Al","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6097"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=6097"}],"version-history":[{"count":4,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6097\/revisions"}],"predecessor-version":[{"id":6256,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6097\/revisions\/6256"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/6099"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=6097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=6097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=6097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}