Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 29, 2006 02:37 PM by tonsai
Jul 22, 2006 11:43 PM|LINK
I have started extending the user registeration module to include more stuff like state, country, etc etc.
But without any documentation, I am wondering which DB table should I add these properties to?
I noticed there is a table called "members", but the two existing user properties in the profile are serialized in the profile table.
So my question is, Should I add these fields to the members table and if not, which table then?
If nyone has already done this, can you give guidance?
Any guidance from MS team will help.
Jul 23, 2006 02:55 PM|LINK
It will be easier to put your data in the aspnet_profile table in the ASPNETDB.
In your webconfig add an entry for whichever fields you wish to save. For example:
<add name="FirstName" type="System.String"/>
<add name="LastName" type="System.String"/>
<add name="Address" type="System.String"/>
<add name="City" type="System.String"/>
<add name="State" type="System.String"/>
<add name="ZipCode" type="System.String"/>
<add name="MemberId" defaultValue="0" type="System.Int32"/>
Then in Register.aspx.vb you need to save those fields. So in the example above it would look like:
userProfile.MemberId = MembersDB.CreateMember(username, Membership.ApplicationName)
userProfile.FirstName = CType(Util.FindControlRecursively("FirstName", CreateUserWizardControl.Controls), TextBox).Text
userProfile.LastName = CType(Util.FindControlRecursively("LastName", CreateUserWizardControl.Controls), TextBox).Text
userProfile.Address = CType(Util.FindControlRecursively("Address", CreateUserWizardControl.Controls), TextBox).Text
userProfile.City = CType(Util.FindControlRecursively("City", CreateUserWizardControl.Controls), TextBox).Text
userProfile.State = CType(Util.FindControlRecursively("State", CreateUserWizardControl.Controls), TextBox).Text
userProfile.ZipCode = CType(Util.FindControlRecursively("ZipCode", CreateUserWizardControl.Controls), TextBox).Text
Then if you need to access that data all you need to do is:
profile.PropertyName ---> profile.ZipCode or profile.State
Jul 23, 2006 03:48 PM|LINK
Yes but I try not to extend MS tables. What happens if MS decides to change their table structure?
I always create my own tables and then use the foreign keys of MS tables to link them.
In that case, my app is portable and if MS changes their table structure, I simply plug in my table.
BUT the biggest problem is that, the profile table is serialized. You can NOT write meaningful queries on them.
Finally, what is the members table in this app used for?
Jul 23, 2006 05:32 PM|LINK
If they decide to make changes, you adapt to those changes and make them at that time. I'm sure if they make a change there will be a way to "upgrade".
I just mentioned the easiest way to "extend" the profile.
But in any case like you said you will just have to create your own table and store all your profile information in that table. Same logic as how it is currently being done, just more code.
I think the members table is just to create the ID which links to the Ads table
What type of queries are you trying to run on the aspnet_profile table. Are you trying to select all members with the PropertyName State for a specific state or something on that order?
Jul 23, 2006 05:54 PM|LINK
I did a little searching, check out the following:
This seems to be what you are trying to accomplish. I haven't really looked at it as I just found it but it seems rather easy to integrate with your current application in terms of modifications to the classifieds app itself
Jul 23, 2006 06:08 PM|LINK
Justin.....I am attempting to do the same thing. You are a life saver....I need your patience though. Please give me the above directions step by step if you don't mind....I am not a advanced user. I would love to implement exactly what you suggested above
but I need step by step instructions. Man I would really appreciate it.
Jul 23, 2006 06:48 PM|LINK
You want to use the aspnet_profile table or you want to create your own custom profile as in the link I provided.
I haven't actually tried the method in the link yet, but I have just added PropertyNames and Values into the aspnet_profile table.
If you want to go that route I can help you out but the other method that was in the link I provided I haven't done yet. It does seem easy to implement though. Basically it looks like they provide you with a sql script, then you just put in your database
name and run it. I'd imagine the script creates a profile table and either creates new stored procs or alters the current stored procs so you will also need to know what fileds you are going to want and add those into the sql scripts. Then, modify your web.config
and your connection strings if you need to.
Let me know which method you are planning on using or if you have any questions. If I can't answer I'm sure someone else can
Jul 24, 2006 12:42 PM|LINK
Thanks Justin. I am opting for the method described in the link. It is more portable and is independent of whatever MS decides to do in the future. I can simply plug in my profile stuff and keep going. I will keep you posted.
Have you by any chance run across a documentation for this application? I will be helpful if MS developers that put out these Starter kits included some documentation.
They did so in the kits that came with Framework 1.xxx like ISpy etc.
Jul 24, 2006 06:51 PM|LINK
Ultimately I am looking to add a address fields that includes city, state and zip on the Post Ad page. I want my users to be able to search what category is close to them.
Jul 24, 2006 09:11 PM|LINK