Showing posts with label users. Show all posts
Showing posts with label users. Show all posts

Thursday, March 29, 2012

Error when trying to delete user

I created many test users in my application while trying to get a custom registration process to work, and now I would like to delete those users so they don't use up space in my database. When I go into the aspnet_Users table and try to delete a user, it gives me the following error:

----------

DELETE statement conflicted with COLUMN REFERENCE constraint 'FK__aspnet_Me__UserI__0F975522'. The conflict occurred in database 'DB_83996', table 'aspnet_Membership', column 'UserId'.

DELETE FROM [DB_83996].[dbo].[aspnet_Users] WHERE 1=0 OR ( [UserId] = '{7E864A07-6FE8-46EF-A2B8-354646D57C76}' )

----------

I don't know much about SQL statements, so is that statement it gave me the statement I need to use to delete that particular user? If not, how would I go about deleting these users I don't need anymore?

Thanks so much. :)

your table "aspnet_Membership" contains records that reference the user record you are trying to delete.

you will need to delete those records first.

|||Thanks. I could have sworn I tried that before because I knew those two tables were linked. Maybe it was something else I tried. Oh well. Thanks!!

Friday, February 24, 2012

Error trying to retreive lastlogon value through LDAP ADSI

I am trying to extract the value of the lastLogon attribute for users in
Active Directory by using LDAP ADSI. Setup is SQL Server 2000 with a linked
server named ADSI, using Query Anaylyzer.
I run the query
SELECT [name], lastlogon
FROM OPENQUERY( ADSI,
'SELECT name, samAccountName, lastlogon
FROM ''LDAP://hostname/OU=BIS Portal Users,DC=bis,DC=dhs,DC=local''
WHERE objectClass = ''user''')
which produces this error:
Server: Msg 7346, Level 16, State 2, Line 1
Could not get the data of the row from the OLE DB provider 'ADSDSOObject'.
Could not convert the data value due to reasons other than sign mismatch or
overflow.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' IRowset::GetData returned
0x40eda: Data status returned from the provider: [COLUMN_NAME=lastlogon
STATUS=DBSTATUS_E_CANTCONVERTVALUE], [COLUMN_NAME=name STATUS=DBSTATUS_S_OK]
].
I did a search on this forum for threads related to this error, and found a
thread discussing problems with querying mult-valued attributes through
OPENQUERY. According to MSDN's section on the AD schema, lastLogon is a
single-valued, 64-bit integer representing the 100 nanosecond intervals sinc
e
January 1, 1601.
I get the same error when I try to query other 64-bit attributes, such as
accountExpires, isAccountLocked, and others that are 100 nanosecond counters
.
I can successfully read badPwdCount, which is a 32-bit counter.
Is there any way to extract those 64-bit counters out of AD using OPENQUERY?Did you ever find a solution to this problem? I'm trying to do the samethin
g.