Showing posts with label membership. Show all posts
Showing posts with label membership. Show all posts

Wednesday, March 28, 2012

Relationship diagram

Hi there,

I just set up my AppData and i'm trying to connect the Membership to a tbl_Profile that i created.
I notice there's an application_id and a user_id which are uniqueidentifiers. I've been trying create a relationship to tbl_Profile's user_id column but it won't let me saying it's not compatible. Am i suppose to set tbl_Profile's user_id column to int or uniqueidentifier? I've tried both and it won't let me...

THanks!

Hello lilboi,

Are there records in the table of which you try to change the column to int or uniqueidentifier?

When the original column type is char(n)/string, you can't change it to int or uniqueidentifier, because the conversion fails.

What relationship are you trying to create? Between what tables and what fields?

Jeroen Molenaar.

|||

hi jeroenm!

There are no records yet. So I was able to have it as int, but it wouldn't connect. THen i changed it to uniqueidentifier but it still wouldn't connect.

WHen i mean by connecting, i meant, when i try to draw a relationship between the column user_id for both the tables.

Thanks!

|||

Let me try to explain:

aspnet_Membership tbl_Profile
---------- -----
user_id 1----to----1 user_id


I try to draw a 1 to 1 relationship by going through Relationship Diagram and then dragging user_id(Profile) to user_id(Membership)


Monday, March 26, 2012

Relational databases

I have a membership database and a profile database with a userid column in both. The foreign key is in the profile database where i want a persons profile details to go like location,occupation and what not. How do I make it so when a new user registers a userId is created in the profile database that matched the userid in the membership database so i can query out profile details based on a registered members userid?

There's a couple of ways -

- Add a separate column for the membership id to the profile.

- Make the UserID in the Profile non-auto generated and set it when you create the record as under

INSERT INTO MembershipTable .....DECLARE @.UserID INTSET @.UserID = SCOPE_IDENTITY() -- gets the identity of the lastnew record-- create the profile recordINSERT INTO ProfileTable (UserId, .... VALUES(@.UserID, ....