title: Why I can't create a table in my database in C#?
body: <p>I'm trying to create a new table in my database but it's not working. See the code below:</p>
  
  <pre><code>public static void creerJoueur(string nom)
  {
          bool ok = true;
          string connexionString = @"DataSource=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Rubis.mdf;Integrated Security=True";
  
          using (SqlConnection connexion = new SqlConnection(connexionString))
          {
              connexion.Open();
              string query = "Create table " + nom +  " (noSemaine int primary key, montant int)";
              SqlCommand commande = new SqlCommand(query, connexion);
  
              try
              {
                  ok = commande.ExecuteNonQuery() == 1;
              }
              catch (Exception)
              {
                  ok = false;
              }
          }
      }
  </code></pre>
  
  <p>I can't see my error. In debug, my program don't go in my catch section, so there is no error. I just can't see my new table. <code>commande.ExecuteNonQuery()</code> returns -1. Please help me.</p>
  
  <p>UPDATE: The code is fine but the table appeared several minutes after running my program. Any solution for this??</p>
  
  <p>UPDATE 2: I created a new database named taxeRubis. In visual Studio, I dont see any table after executing my code. If I go in sql server, there is 2 database named taxeRubis not at the same location: gyazo.com/5c05765b9b8f4ee8312329edf01e157e One have my table named Bodhis, the other don't. Why I have now 2 databases?</p>