Solved

how to add the following to membership table in aspnetdb.mdf

Posted on 2008-10-25
7
464 Views
Last Modified: 2012-08-13
I have the following:

<profile defaultProvider="OL_ProfileProvider">
      <providers>
        <add name="OL_ProfileProvider" connectionStringName="LocalSqlServer" type="System.Web.Profile.SqlProfileProvider"/>
      </providers>
      <properties>
        <add name="Email"/>
        <add name="UserName"/>
        <add name="Password"/>
        <add name="FullName"/>
        <add name="Gender"/>
        <add name="DOB" type="System.DateTime"/>
        <add name="City"/>
        <add name="Region"/>
        <add name="Country"/>
      </properties>
    </profile>
how do are these created. I think they are binaries that I cannot see.

0
Comment
Question by:mathieu_cupryk
  • 4
  • 3
7 Comments
 
LVL 12

Expert Comment

by:techExtreme
ID: 22802382
Hello,
I see you have created few profile properties. Actually you cannot see them directly just by looking at profile table in say the SQL diagram or so. So in a way they are hidden. Actually the names are stored in the rows internally. You do not need to create the required fields in database, they get created automatically once you define them in web.config.

When you enable Personalization in your ASP.NET 2.0 website you can set up a collection of properties that will be maintained for each user of your website (even for the anonymous visitors), which  is exactly what you did.

 Personalization Profiles are often used to store personal data of website users, their personal preferences, visual themes, language settings etc.
 
 Here is a sample Profile setup in web.config:
    <system.web>
    ...
    <anonymousIdentification enabled="true" />
    <profile>
      <properties>
        <add name="UserCulture" defaultValue="en-US"></add>
      </properties>
    </profile>
    ...
  </system.web>

So we have added property to be stored for each user (to keep their language preferences) and here is how we can access them in our code:
 
      this.Culture = this.Profile.UserCulture;
This is because the profile class is generated dynamically (on the fly) using the properties you define in web.config.  You just simply have to use them in your code as required to fetch user specific information.

Hope this helped.

Enjoy Coding!
0
 

Author Comment

by:mathieu_cupryk
ID: 22804402
if i have a datetimepicker of type string.
I cannot convert it. before it goes into the table.
So should i just leave this type string.
0
 
LVL 12

Expert Comment

by:techExtreme
ID: 22804445
Hia, yet it will work if you leave it as type string but remember that you will get it as a string too.
I myself follow a common rule regarding date if it is to be stored in string format which is tht always pass it in format dd-MON-yyyy and retrieve accordingly, that way you need not to worry about the backend, for example how the sql server requires date to be in specific format or not etc..
Anyways hope i solved the doubt, let me know of any issues.
Enjoy Coding!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:mathieu_cupryk
ID: 22804892
here now I need to pass a datetime
Profile.DOB needs to be of datetime.
   lblZodiacSign.Text = ZodiacSign(Profile.DOB);
    lblAge.Text = getAge(Profile.DOB);
0
 
LVL 12

Accepted Solution

by:
techExtreme earned 500 total points
ID: 22804993
Yes I don't see any problem in it.
Assuming your Profile.DOB holds valid datetime value as  a string, you can do Convert.ToDatetim Profile.DOB) and you'll get the datetime.
Is there any problem with the code you posted? have you tried convert.todatetime as I suggested?
let me know of any issues.
Thanks,

Enjoy Coding!
0
 

Author Closing Comment

by:mathieu_cupryk
ID: 31509908
very well answered question. detailed, and write to the point.
0
 
LVL 12

Expert Comment

by:techExtreme
ID: 22806081
Thanks. Enjoy Coding!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now