Solved

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

Posted on 2008-10-25
7
468 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

717 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