Last post Aug 04, 2007 02:21 PM by smcoxon
Aug 03, 2007 08:16 PM|thiennhien|LINK
I have a question that I have been wondering when developing this classified kit. Is it better to store user's information in db or aspnetdb (membership profile)? There's a table called classified_members which stores user's info. There's also a table
in aspnetdb to store user's profile. When I want to add more info about the user, where would be the best place to store it? Thanks for all your help.
Aug 03, 2007 09:28 PM|smcoxon|LINK
Hi, I guess this really depends on how many more fields you want to store. I configure additional fields in the aspnetdb by configuring profile properties in the webconfig file. E.g.
<add name="FirstName" />
<add name="LastName" />
<add name="Address1" />
<add name="Address2" />
<add name="Address3" />
<add name="TownCity" />
<add name="County" />
<add name="PostCode" />
<add name="PhoneNumber" />
Then create a sub procedure that writes textbox input to the profile properties, which wll be stored in the membership database aspnet_profile table for the logged in user. E.g.
Protected Sub BtnSaveDetails1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSaveDetails.Click
'Add all the personal information to the members profile database table
Profile.FirstName = Trim(txtFirstName.Text)
Profile.LastName = Trim(txtLastName.Text)
Profile.Address1 = Trim(txtAddress1.Text)
Profile.Address2 = Trim(txtAddress2.Text)
Profile.Address3 = Trim(txtAddress3.Text)
Profile.TownCity = Trim(txtTownCity.Text)
Profile.County = Trim(txtCounty.Text)
Profile.PostCode = Trim(txtPostCode.Text)
Profile.PhoneNumber = Trim(txtPhone.Text)
If you have lots of additional fields, say 50 or more, then i'd set up a new table in the aspnetdb with a relationship between the aspnet_Membership table 'UserId' field (users uniqueidentifier) and a foreign key Field 'UserId' within the new table which
wil also hold the additional fields.
Hope this helps.
Aug 04, 2007 02:50 AM|thiennhien|LINK
Thanks a lot for your input. I fully understand the work that you're trying to show above. There's already a table called classifieds_members in the database. When would I use this table for additional fields? What's really the use of classifieds_members
table anyway when i could access right from the membership table in aspnetdb? I am just confused about all of this membership thing right now. Hope you can guys can help me out. Thanks.
Aug 04, 2007 01:44 PM|darkknight187|LINK
Technically it doesn't matter which database you use for adding additional columns.
But the reason for the members table is to give the application a way of connecting the member with which ad.
Aug 04, 2007 02:21 PM|smcoxon|LINK
I've just had a quick look at the Classified starter kit and it seems that this app is using the standard membership controls, Login, Register etc, but also creating some more fields, Id, username, aspApplicationName,
dateCreated, in the ClassifiedDB - ClassiFields_Members table. But the user FirstName, LastName and MemberId (taken from the ID returned by the stored procedure (InserMember), which inserts the additional
member information in to the ClassiFields_Members table) are stored in the ASPNETDB - aspnet_profile table. Take a look at the Web.config Profile Properties settings and you will see FirstName, LastName and MemberId properties.