title: SQL code for last login not working
body: <p>I have a login system that uses SQL to create and login users. I also have a update SQL statement on the login page that will show the data that you last logged in on. For some reason my SQL code is not working. </p>
  
  <p>Here is my code:</p>
  
  <p><code>UPDATE logins SET lastlogon = NOW() WHERE username = @user</code></p>
  
  <p>When I execute this SQL statement it does not update the database for some reason it does not work. I am using Asp.net 4.5. This is also MYSQL code if the will make a difference. I have done a little research and some people have said some stuff about formatting but I have not been able to fix my mysql code. I would like my code to update the database so I can see who logged in at which time. My code does not throw a specific error but it just does not work.</p>
  
  <p>update I now know that it is probably not the SQL code and it is the C# backend. </p>
  
  <p>So here is my code:</p>
  
  <pre><code>data connection = new data();
  connection.newconnection();
  MySqlCommand update = new MySqlCommand("UPDATE logins SET lastlogon = NOW() WHERE username = '@user'", connection.connect);
  update.Parameters.AddWithValue("@user", HttpContext.Current.User.Identity.Name.ToString());
  update.ExecuteNonQuery();
  FormsAuthentication.RedirectFromLoginPage(username.Text, false);
  connection.closeconnection();
  update.Dispose();
  </code></pre>