title: SQL Command with string as Tablename
body: <pre><code>private DataTable zGetTableContent(string tablename)
  {
          DataTable dt = new DataTable();
          Connection.Open();
  
          MessageBox.Show(tablename);
  
          Adapter = new OleDbDataAdapter("SELECT * FROM '%" + tablename + "%'", Connection);
          Adapter.Fill(dt);
  
          Connection.Close();
          return dt;
  }
  </code></pre>
  
  <p>Trying to get the above code working, but struggling with it. I guess I'm doing something wrong with the string. But can't figure out what.</p>
  
  <p>The string is perfectly transferred to the method. MessageBox shows the correct string. But my adapter says </p>
  
  <blockquote>
    <p>Syntax error in query. Incomplete query clause</p>
  </blockquote>
  
  <p>If I type in the tablename by myself, everything works fine.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The connected database (Access):</p>
  
  <pre><code>    static private OleDbConnection Connection = new OleDbConnection();
  
      private void zPrepConnect(string SourceFile)
      {
          Connection.ConnectionString = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source = {0};", SourceFile);
          Command.Connection = Connection;
      }   
  </code></pre>
  
  <p><strong>EDIT #2:</strong>
  Tablenames are as followed:</p>
  
  <ul>
  <li>rstw</li>
  <li>simis is</li>
  <li>simis w</li>
  <li>simis c</li>
  </ul>
  
  <p><strong>EDIT #3:</strong>
  Removed spaces from tablenames but still not working:</p>
  
  <ul>
  <li>rstw</li>
  <li>simis_is</li>
  <li>simis_w</li>
  <li>simis_c</li>
  </ul>