Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationHow do I modify userHow do I modify user's name?
Previous
 
Next
New Post
8/16/2006 9:30 AM
 

In my web site, I have a user named "Lina". But now I have to change "Lina" to "Lina Lee".

I use these two script to do it:

update users set username = 'Lina Lee' where username = 'Lina'

update aspnet_users set username = 'Lina Lee' where username = 'Lina'

 

But after I run these script, I can access the "User Account" page, I always get errors.

Can anybody tell me what mistakes I make?

By the way, I use AD to log on!

Thank you!

 
New Post
8/16/2006 12:55 PM
 
You'll want to change the last name in the User table (not the aspnet_User table).  If the lastname field is NULL, it will break your user administration for that user.

Try inserting a lastname directly into the User table and see if that fixes both of your problems
 
New Post
8/16/2006 8:23 PM
 

Actually I want to modify the username, not the last name or first name.

My problem is that we will use the AD instead of the old log on way which need user to type the username and password. But the username of the users who we create before we use AD are not their domain account. So I want to modify them to domain account. It seems very difficult. Because after I update the username, I always get errors when I access the "User Account" page.

 
New Post
8/26/2006 11:28 AM
 

Taken from forums some time ago. Don't remember the author and not tested yet

declare @oldName nvarchar(128)
declare @newName nvarchar(128)
declare @error_var int, @rowcount_var int
declare @newNameCount int

select @oldName = 'johndoe1'
select @newName = 'johndoe2'


begin transaction

 select @newNameCount = count(*)
  from Users
  where Username = @newName
 if @newNameCount > 0
 begin
  RAISERROR('Username already exists. @newName=%s', 10, 1, @newName)
  ROLLBACK TRANSACTION
  RETURN
 end

 update Users
 set Username = @newName
 where Username = @oldName
 
 SELECT @error_var = @@ERROR, @rowcount_var = @@ROWCOUNT
 IF @rowcount_var <> 1 OR @error_var <> 0
 BEGIN
  RAISERROR('Could not Update User.Username. @oldName=%s', 10, 1, @oldName)
  ROLLBACK TRANSACTION
  RETURN
 END
 
 
 update aspnet_Users
 set
  Username = @newName,
  LoweredUserName = LOWER(@newName)
 where LoweredUserName = LOWER(@oldName)
 
 SELECT @error_var = @@ERROR, @rowcount_var = @@ROWCOUNT
 IF @rowcount_var <> 1 OR @error_var <> 0
 BEGIN
  RAISERROR('Could not Update aspnet_Users.Username. @oldName=%s', 10, 1, @oldName)
  ROLLBACK TRANSACTION
  RETURN
 END

Commit transaction
go


Locopon
Free modules: E-commerce, Complete localization (Portal, page, module settings, skins, etc.), Secure Login, and more
http://dnn.tiendaboliviana.com
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationHow do I modify userHow do I modify user's name?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out