title: Fill DataTable from SQL Server database
body: <p>This one is a mystery for me, I know the code I took it from others, in my case the datatable it returns is empty</p>
  
  <p><code>conSTR</code> is the connection string, set as a global string</p>
  
  <pre><code>public DataTable fillDataTable(string table)
      {
          string query = "SELECT * FROM dstut.dbo." +table;
  
          SqlConnection sqlConn = new SqlConnection(conSTR);
          sqlConn.Open();
          SqlCommand cmd = new SqlCommand(query, sqlConn);
  
          DataTable dt = new DataTable();
          dt.Load(cmd.ExecuteReader());
          sqlConn.Close();
          return dt;
      }
  </code></pre>
  
  <p><strong>EDIT 1</strong><br>
  The whole point is to later show this table in a datagrid view on a tabcontrol, here is the question on that
  <a href="https://stackoverflow.com/questions/16917046/displaying-multiple-datatable-in-tabcontrol-c-sharp">displaying multiple datatable in tabcontrol C#</a></p>
  
  <p>Here it just show's me a blank datagridview</p>
  
  <p><strong>EDIT 2</strong><br>
  Tried them all, when I try to display the table, the datagridview is empty, have the right amount of rows but now value</p>