Wednesday, March 28, 2012

Relationship to UserId

Hi there everyone, this is my first post so go easy on me :)

Basically I am trying to get my database to copy the value in the UserId (unique identifier field) from the aspnet_Users table to a foreign key UserId in a table called userclassset. I have made this field the same datatype and created a relationship between the two. Unfortunately, when I add a user using the ASP.Net configuration tool it does not automatically copy this value into my own custom table. I have noticed it is however automatically copied into the aspnet_Membership table. Any pointers on how to solve this would be great!

Thanks :)

ascension:

?I have noticed it is however automatically copied into the aspnet_Membership table. Any pointers on how to solve this would be great!

This is because when you?use?.NET2.0?built-in?function?to create user,?the?aspnet_Users_CreateUser?stored?procedure?is?called.?This?stored?procedure?will?not?only?insert?a?row?in?aspnet_users?table,?but?also?do?some?operations?on?aspnet_Memebership?table,?you?can?use?sp_helptext?to?view?the?definition:

sp_helptext aspnet_Users_CreateUser

So if you want to insert some row into your own custom table, you can either: alter the aspnet_Users_CreateUser to add your own statements (preferred); orcreate a?insert trigger?on?the?aspnet_users?table|||Brilliant, worked perfectly. Thanks :)

No comments:

Post a Comment