title: Output SQL result to a table
body: <p>How can the code be modified below to dynanically generate the results of my SQL query to a table that would like the example table below? (2 items per table row)
  </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
      function test() {
          try {
              alert("running function test")
          var cn      = new ActiveXObject("ADODB.Connection")
          var rs      = new ActiveXObject("ADODB.Recordset")
          var sql     = "SELECT * FROM tbl_rssims"
          var db      = "G:\\AS\\Asf\\ASF\\RSSIMS\\db\\rssims.mdb"
  
          cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + db + "")
          rs.Open(sql, cn, 1, 3)
  
          var html    =  '&lt;!DOCTYPE html&gt;\n'
              html    +=  '&lt;html&gt;\n'
              html    +=  '&lt;head&gt;\n'
              html    +=  '&lt;table style="border: none; table-layout: fixed; width: 100%; text-align: left;" cellpadding="0" cellspacing="0"&gt;\n'
  
              //&lt;!-- WRITE FIELD VALUES --&gt;
              while (!rs.eof) {
                  html += '&lt;tr&gt;\n';
                  for (var c = 0; c &lt; rs.fields.count; ++c) {
                      html += '&lt;td&gt;' + rs.fields(c).value + '&lt;/td&gt;\n'
                  }//end of for
                  html += '&lt;/tr&gt;\n'
                  rs.movenext
              }//end of while
              html += '&lt;/table&gt;'
              window.open('','').document.write(html)
  
          rs.close
          cn.close
      }//end of try
      catch(e) {
          alert(e.description)
      }
  }//end of function
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;b&gt;Example:&lt;/b&gt;
      &lt;table style="border: none; table-layout: fixed; width: 100%; text-align: left;" cellpadding="0" cellspacing="0"&gt;
          &lt;tr&gt;
              &lt;td&gt;Mr. Ronald McDonald&lt;br&gt;Chief Executive Officer&lt;br&gt;The Hudson Bay Corporation&lt;br&gt;123 Yahoo Street&lt;br&gt;Toronto, Ontario&lt;br&gt;Canada&lt;/td&gt;
              &lt;td&gt;Mr. Steve Marin&lt;br&gt;Chief Executive Officer&lt;br&gt;General Motors&lt;br&gt;456 Don Mills Street&lt;br&gt;Toronto, Ontario&lt;br&gt;Canada&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;input onclick="test()" type="button" value="button" id="button"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>