title: What is wrong with my SQL insert formatting that c# is not executing it?
body: <pre><code>            string first = user1.FirstName;
              string last = user1.LastName;
              string ticket = user1.Ticket;
              string age = Convert.ToString(user1.Age);
              string command = Convert.ToString(("Insert into [TicketingVoting].dbo.Registration1 (FirstName,LastName,Age,Ticket) VALUES ('{0}','{1}','{2}','{3}');", first, last, age, ticket));
              try
              {
                  SqlConnection conn = new SqlConnection("Data source=(local); Database=TicketingVoting;User Id=****;Password=****");
                  conn.Open();
  
                  SqlCommand insertdata = new SqlCommand(command, conn);
                  insertdata.ExecuteReader();
                  Console.WriteLine("Inserting Data Successfully");
                  conn.Close();
              }
              catch (Exception e)
              {
                  Console.WriteLine("Exception Occur while creating table:" + e.Message + "\t" + e.GetType());
              }
          }
      }
  </code></pre>
  
  <blockquote>
    <p>Exception Occur while creating table:Incorrect syntax near the keyword 
    'Insert'.
    Incorrect syntax near ','.      System.Data.SqlClient.SqlException
    Press any key to continue . . .</p>
  </blockquote>
  
  <p>I am completely stumped as to why when I try to run  my program, I get a this exception thrown at me. The program as a whole simply is registering someone into a database with a unique 'ticket' attached to it. I can gather the data no problem and the connection to my database is created but I get a syntax error for my insert statement.</p>