title: How to update current user in access database via c#
body: <p>I'm having problems updating(editing) current user data (user that is currently logged in application).</p>
  
  <p>I'm using C# WPF and im trying to update(edit) it via UPDATE statement.</p>
  
  <p>I'm having problems with program recognizing user ID (at least i think so).</p>
  
  <p>How can i update current user, without user entering his ID, because ID is a data only administrator is supposed to know in this case. </p>
  
  <p>If i leave out the WHERE[ID] = ? , it updates the same data for all the users.</p>
  
  <p>This is my code</p>
  
  <pre><code>try
          {
              //CONNECTION STRING ALREADY CONNECTED
              cmd.Connection = db;
              cmd.CommandText = "UPDATE User SET [Name] = ?, [LastName] = ?, [UserName] = ?, [Password] = ?, [Address] = ?, [Email] = ? WHERE [ID] = ?";
              cmd.Parameters.AddWithValue("@Name", name.Text);
              cmd.Parameters.AddWithValue("@LastName", lastName.Text);
              cmd.Parameters.AddWithValue("@UserName", userName.Text);
              cmd.Parameters.AddWithValue("@Password", pass.Text);
              cmd.Parameters.AddWithValue("@Address", address.Text);
              cmd.Parameters.AddWithValue("@Email", eMail.Text);
              cmd.Parameters.AddWithValue("@ID", "?");             
  
              db.Open();
              cmd.ExecuteNonQuery();
              MessageBox.Show("User updated!");
              db.Close();
  
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
  </code></pre>