Methode update qui ne fait rien
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| public partial class EditionUsers : System.Web.UI.Page
{
private string ConnectionString;
private string iduser;
protected void Page_Load(object sender, EventArgs e)
{
ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString;
}
protected void Button1_Click(object sender, EventArgs e)
{
string query;
query = "UPDATE aspnet_UsersInRoles SET UserId= UserId, RoleId=@RoleId WHERE UserId= '" +iduser;
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlCommand myCommand = new SqlCommand(query, myConnection);
myConnection.Open();
Response.Write(DropDownList1.SelectedValue.ToString());
SqlParameter RoleId = new SqlParameter();
RoleId.ParameterName = "@RoleId";
RoleId.SqlDbType = SqlDbType.UniqueIdentifier;
RoleId.Value = DropDownList1.SelectedValue.ToString();
myCommand.Parameters.Add(RoleId);
myConnection.Close();
}
} |
VOila mon buton 1 devrais mettre a jour ma table role et la elle ne fait rien. Quelqu'un verrais le probleme?
Merci d'avance