title: Can I/Should I use FILL to fill a DATATABLE in VB.NET 2010
body: <p>I am a brand new, genuine noob, late starter, no previous coding experience at all AND yet also a (also brand new) trainee vb.net developer (internal move from different business area, not IT or anything, very much sink or swim in-at-the-deep-end).</p>
  
  <p>First task is to 'modernise' a paper procedure, I have a simple front end that works ok. I am trying to process the DB entries that writes, later in a seperate console app, but I can't get the entries into a datatable (very simple DB, single table, dataset would be too complicated?).</p>
  
  <p>I am not sure how to use modules, methods etc; my front end was a couple of simple forms so that kinda made it easier.</p>
  
  <p>I've sourced the basic gist from Wrox Beginning VB2010 as employer is on VS2010. It says that fill works for dataset and datatable; I know that the table is created with the correct columns BUT it does not fill.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Dim objDataAdapter As SqlClient.SqlDataAdapter
  Dim objConnection As SqlClient.SqlConnection
  
  Dim strConn As String
  Dim strTableName As String = "MyTableName"
  
  Sub Main()
  
      strConn = "Server = MySQLServer\Name: Database = MyDatabase; Integrated Security = SSPI; Application Name =MyApplicationName"
  
      objDataAdapter = New SqlClient.SqlDataAdapter()
      objDataAdapter.SelectCommand = New SqlClient.SqlCommand
      objDataAdapter.SelectCommand.Connection = objConnection
      objConnection = New SqlClient.SqlConnection(strConn)
      objConnection.Open()
  
      objDataAdapter.SelectCommand.CommandText = "SELECT [MyFirstSQLColumn]"
      objDataAdapter.SelectCommand.CommandText &amp;= ",[MySecondSQLColumn]"
      objDataAdapter.SelectCommand.CommandText &amp;= "WHERE DATE IS TODAY(sic)"
  
      Dim dtbTodaysTableEntries As New DataTable(strTableName)
      dtbTodaysTableEntries.Columns.Add("FirstDTColumn")
      dtbTodaysTableEntries.Columns.Add("SecondDTColumn")
  
      objDataAdapter.Fill(dtbTodaysTableEntries)
      objConnection.Close()
  
  End Sub
  </code></pre>
  
  <p>Please, how to fix and what am I not understanding (gentle now) thanks.</p>