这是会员表,我找到了解决方案。这是 :
sqlcmd = new SqlCommand("SELECT RoleId FROM aspnet_Roles where RoleName=@RoleName", sqlconn);
sqlcmd.Parameters.AddWithValue("@RoleName", "Reviewer");
sqlconn.Open();
System.Guid RoleId = ((System.Guid)sqlcmd.ExecuteScalar());
sqlcmd = new SqlCommand("SELECT UserId FROM aspnet_Users where UserName=@UserName", sqlconn);
sqlcmd.Parameters.AddWithValue("@UserName", EditorUserName);
System.Guid UserId = ((System.Guid)sqlcmd.ExecuteScalar());
sqlcmd = new SqlCommand("SELECT RoleId FROM aspnet_Roles where RoleName=@RoleName", sqlconn);
sqlcmd.Parameters.AddWithValue("@RoleName", "ReviewerEditor");
System.Guid ReviewerEditorRoleId = ((System.Guid)sqlcmd.ExecuteScalar());
sqlconn.Close();
/// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
sqlcmd = new SqlCommand("UPDATE aspnet_UsersInRoles SET RoleId = @RoleId WHERE (UserId= @UserId)", sqlconn);
sqlcmd.Parameters.AddWithValue("@RoleId", ReviewerEditorRoleId);
sqlcmd.Parameters.AddWithValue("@UserId", UserId);
sqlconn.Open();
sqlcmd.ExecuteNonQuery();
sqlconn.Close();