title: Retrieving MsAccess Data to ComboBox in VC++ form Application
body: <p>Hi i am trying to retrieve data from Ms Access database in <code>VC++</code>. As i am a new to <code>VC++</code>, please help me. </p>
  
  <p>Here is the code i have written so far. </p>
  
  <pre><code>System::Data::DataSet^ ds=gcnew System::Data::DataSet();
  
          OleDbConnection ^ con=gcnew OleDbConnection("Provider= Microsoft.ACE.OLEDB.12.0;Data source=dbmc.accdb; Persist Security Info=True");
          OleDbCommand^ com =gcnew OleDbCommand();
          OleDbDataReader^ myReader;
          com-&gt;CommandText ="SELECT name FROM Table1";
          com-&gt;Connection = con;
          con-&gt;Open();
          try
          {
              myReader=com-&gt;ExecuteReader();
              while(myReader-&gt;Read())
              {
                  String^ vName = myReader-&gt;GetString('name');
                  comboBox1-&gt;Items-&gt;Add(vName);
                  myReader-&gt;Close();
              }
          }
          catch(Exception^ex)
          {
              MessageBox::Show(ex-&gt;Message);
          }   
  </code></pre>
  
  <p>When I run this program i get an error <code>"Index Out of Bound"</code>.</p>