title: How can I add the value of a single Cell from Access database to a string variable
body: <p>As the title says I have a MS Access database from where I need to find a specific dataset determined by a String Value. the reason for having to do this is so I can find the value of a single cell in this datase which has to be used as a path to find a certain file. my approach so far is the following:</p>
  <pre><code> Dim conn As New OleDb.OleDbConnection(&quot;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\ExaptLokal.accdb&quot;)
  Dim cmd As New OleDb.OleDbCommand
  Dim dt As New DataTable
  Dim da As New OleDb.OleDbDataAdapter
  Dim sql As String
   sql = &quot;SELECT NC_KEY FROM EXAPT_NC_KOPF_DATEN WHERE NC_PROGRAMM_NAME =&quot; &amp; ProgrammNr.Text.ToString
          MsgBox(sql)
          conn.Open()
          cmd.Connection = conn
          cmd.CommandText = sql
          da.SelectCommand = cmd
          da.Fill(dt)
          fullpath = dt.ToString
  </code></pre>
  <p>at the end I would like to have the result from my SQL Query as the value of my &quot;fullpath&quot; variable but so far the <code>da.Fill(dt)</code> row is giving me a hard time saying there is a conflict with the datatype.</p>
  <p>Is the datatable even needed in this case or might I be able to skip that step and get the result of the query directly in the fullpath variable?</p>
  <p>Thanks to everyone in advance</p>
  <p>Edit: Thanks for the help (though not the friendliest but who am I to judge) I finally got it to work with the <code>Execute Scalar</code> method. I would just wish newbies to this website would be greeted a little better lol
  have a great day</p>