title: Get result of MS Access query into textbox in VB.NET
body: <p>I have a table in MS Access which has a colum named NameC (using ODBC to connect to MS Access)</p>
  
  <p>I want the result of the following query to be saved in a txtField</p>
  
  <pre><code>Dim query = "SELECT NameC FROM Table WHERE ClientID = " &amp; Integer.Parse(clientID) 
  </code></pre>
  
  <p>How to do that in VB.NET?</p>
  
  <p>I have a <code>txtNameC.Text</code> field</p>
  
  <p>I currently was reviewing some sample code and they do:</p>
  
  <pre><code>  Dim _consultationTable As DataTable
    Public Sub Load()
      Dim query = "SELECT * FROM Table WHERE ClientID = " &amp; Integer.Parse(clientID)
      Me._consultationTable = DatabaseFunctions.GetDataTable(query)
      dvgInfo.Rows.Clear()
      For Each  dtRow In Me._consultationTable.Rows
          dvgInfo.Rows.Add()
          dvgInfo.Rows.Add(dvgInfo.RowCount-1).Cells("ColClientID").Value = dtRow("ClientId").ToString()
     Next
  </code></pre>
  
  <p>but I do not want to fill a table I just want to get the result of a query into a text box
  How can I do this?</p>
  
  <p>I want to do something like this but just return a value and save it into a textbox</p>
  
  <pre><code>Protected Sub BindData()  
     strSQL = "SELECT * FROM customer"  
  
     Dim dtReader As OdbcDataReader  
     objCmd = New OdbcCommand(strSQL, objConn)  
     dtReader = objCmd.ExecuteReader()  
  
     '*** BindData to GridView ***'  
     myGridView.DataSource = dtReader  
     myGridView.DataBind()  
  
     dtReader.Close()  
     dtReader = Nothing  
  End Sub  
  
  
  Protected Sub BindData()  
     strSQL = "SELECT SpecificValue FROM customer where x = y..."  
  
     Dim dtReader As OdbcDataReader  
     objCmd = New OdbcCommand(strSQL, objConn)  
     dtReader = objCmd.ExecuteReader()  
  
     '*** BindData to GridView ***'  
     myGridView.DataSource = dtReader  
     myGridView.DataBind()  
  
     dtReader.Close()  
     dtReader = Nothing  
  End Sub  
  </code></pre>