title: Trying to use an INSERT method but not working
body: <p>i'm trying to use an <code>insert</code> method in my <code>studentHelperClass</code>, I am trying to activate it on a button click on my form, I don't know how to make it work with a text box, so if someone could help with that, that would be great.</p>
  
  <p>This is my method:</p>
  
  <pre><code>public static void insertStudent()
          {
              MySqlConnection conn = connection();
              conn.Open();
              MySqlCommand cmd = new MySqlCommand();
              cmd.Connection = conn;
              string myInsertSQL = "INSERT INTO person(personID) ";
              cmd.Prepare();
              myInsertSQL += "VALUES (@personID)";
              cmd.Parameters.AddWithValue("@personID", "123345667788");
              prevID(conn, cmd);
          }
  </code></pre>
  
  <p>and this is my form:</p>
  
  <pre><code>private void btnInsert_Click(object sender, EventArgs e)
                   {
                       studentHelperClass.insertStudent();
                   }
  </code></pre>
  
  <p>EDIT:</p>
  
  <pre><code>private static void prevID(MySqlConnection conn, MySqlCommand cmd)
          {
              conn.Open();
              cmd.ExecuteNonQuery();
              long studentNumber = (long)cmd.LastInsertedId;
              Console.Write("previous id {0} ", studentNumber);
              Console.ReadLine();
              conn.Close();
          }
  </code></pre>