Thanks to the help Ive recieved from zambonee on write a query that applies to an entire db instead of a table
Using EF i'm writing a query that returns the userId from the aspNet_Users table. Then Im using this ID to delete the records in membership, userINroles & users....However the userId the query is returning is the wrong value..and Im connected to the correct DB iv checked the connectionString and tested other data
using (DEntities Context = DAOHelper.GetObjectContext<DEntities>())
{
Guid aspUserIdToRemove = Context.ExecuteStoreQuery<string>("Select UserId FROM aspnet_Users where UserName LIKE '%" + userName + "%'").ElementType.GUID;
string aspUserId = aspUserIdToRemove.ToString();
aspUserId = aspUserId.Replace("{", string.Empty);
aspUserId = aspUserId.Replace("}", string.Empty);
Context .ExecuteStoreCommand("DELETE FROM aspnet_Membership where UserId = '" + aspUserId + "'");
Context .ExecuteStoreCommand("DELETE FROM aspnet_UsersInRoles where UserId = '" + aspUserId + "'");
Context .ExecuteStoreCommand("DELETE FROM aspnet_Users where UserId = '" + aspUserId + "'");
aspUserIdToRemove returns {296afbff-1b0b-3ff5-9d6c-4e7e599f8b57} when it should return {31E62355-8AE2-4C44-A270-2F185581B742}...
{296afbff-1b0b-3ff5-9d6c-4e7e599f8b57} doesnt even exist in the DB...does anyone have any idea whats wrong? thanks
Just to reinforce about being on the same DB im doing further delete commands on different tables and confirming that they are deleted
Following on from the comments -
var s = dnnEntitiesDbContext.ExecuteStoreQuery<string>("Select UserId FROM aspnet_Users where UserName LIKE '%" + userName + "%'");
s.elementtype.GUID holds the 296afbff-1b0b-3ff5-9d6c-4e7e599f8b57
but s.base.elementType.baseType.Guid returns a diff GUID '81c5f.... but no sign of the one I am looking