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.
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.
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)
End Sub
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.
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.
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.
So in my opinion, this starter kit is using the standard membership controls and ASPNETDB for crating and storing all membership information. But any data specifically created for use by the application is being stored
in a separate database. This is generally good house keeping. I.e. keep the app data in a separate db from the membership data. However, there is nothing to stop you from creating new tables in the ASPNETDB, I do just that in my apps. I have considered using
a separate DB for my apps but this often increases the cost of your hosting service. Many hosting providers will charge more for hosting web apps that have 2, 4 or more DB's. So the choice is entirely yours but if you do not have your own IIS servers and SQL
servers then you need to check out the cost of hosting multiple DB's with an ASP.NET service provider before you make your final decision.This starter kit uses a Data Access Layer and Business Logic Layer
to access the information in the ClassifiedDB. Take a look at the following for useful information if you want to follow this DAL & BLL approach for your data app structure:
http://www.asp.net/learn/data-access/
Regards
Smcoxon
No Gem is ever polished without some friction.
Marked as answer by thiennhien on Aug 07, 2007 02:43 PM
thiennhien
Member
36 Points
24 Posts
should I store member's information in db or aspnetdb(membership profile)?
Aug 03, 2007 08:16 PM|LINK
Hi all,
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.
Vinh
smcoxon
Contributor
5455 Points
948 Posts
Re: should I store member's information in db or aspnetdb(membership profile)?
Aug 03, 2007 09:28 PM|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.
<profile> <properties> <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" /> </properties> </profile>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.
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.
Smcoxon
No Gem is ever polished without some friction.
thiennhien
Member
36 Points
24 Posts
Re: should I store member's information in db or aspnetdb(membership profile)?
Aug 04, 2007 02:50 AM|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.
darkknight18...
Contributor
2674 Points
1040 Posts
Re: should I store member's information in db or aspnetdb(membership profile)?
Aug 04, 2007 01:44 PM|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.
Please remember to mark the post as answer that solves your issue.
This will be greatly benificial for other users.
smcoxon
Contributor
5455 Points
948 Posts
Re: should I store member's information in db or aspnetdb(membership profile)?
Aug 04, 2007 02:21 PM|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.
So in my opinion, this starter kit is using the standard membership controls and ASPNETDB for crating and storing all membership information. But any data specifically created for use by the application is being stored in a separate database. This is generally good house keeping. I.e. keep the app data in a separate db from the membership data. However, there is nothing to stop you from creating new tables in the ASPNETDB, I do just that in my apps. I have considered using a separate DB for my apps but this often increases the cost of your hosting service. Many hosting providers will charge more for hosting web apps that have 2, 4 or more DB's. So the choice is entirely yours but if you do not have your own IIS servers and SQL servers then you need to check out the cost of hosting multiple DB's with an ASP.NET service provider before you make your final decision.This starter kit uses a Data Access Layer and Business Logic Layer to access the information in the ClassifiedDB. Take a look at the following for useful information if you want to follow this DAL & BLL approach for your data app structure: http://www.asp.net/learn/data-access/Smcoxon
No Gem is ever polished without some friction.