public override void UpdateUser(MembershipUser user)
{
SqlConnection conn = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand("UPDATE Users " +
" SET Email = @Email, Comment = @Comment," +
" IsApproved = @IsApproved" +
" WHERE Username = @Username AND ApplicationName = @ApplicationName", conn);
cmd.Parameters.AddWithValue("@Email", user.Email);
cmd.Parameters.AddWithValue("@Comment", user.Comment);
cmd.Parameters.AddWithValue("@IsApproved", user.IsApproved);
cmd.Parameters.AddWithValue("@Username", user.UserName);
cmd.Parameters.AddWithValue("@ApplicationName", pApplicationName);
try
{
conn.Open();
cmd.ExecuteNonQuery();
}
catch (SqlException e)
{
if (WriteExceptionsToEventLog)
{
WriteToEventLog(e, "UpdateUser");
throw new ProviderException(exceptionMessage);
}
else
{
throw e;
}
}
finally
{
conn.Close();
}
}