I know I can use the code below to store user's profile data, If I want to search a user who's first name is "First Name", I have to compare them one by one, I think it's vey slow, is there a better way?
And more, I think if I store FirstName field in a individual table, I can use the SQL to serach the user (select username from usertable where firstname='First Name'), it's simple and quick! so I think it's better to use a individual table to store user's profile data, is it right?
-------------------------------------Web.config--------------------------------
<profile>
<properties>
<add name="FirstName" type="System.String"/>
<add name="LastName" type="System.String"/>
</properties>
</profile>
-------------------------------------Web.config--------------------------------
-------------------------------------Search Profile -----------------------------
protected void Button1_Click(object sender, EventArgs e)
{
Profile.FirstName = "First Name";
Profile.LastName = "Last Name";
}
protected void btnSearch_Click(object sender, EventArgs e)
{
MembershipUserCollection allUsers = Membership.GetAllUsers();
foreach (MembershipUser user in allUsers)
{
if (Profile.GetProfile(user.UserName).FirstName == "First Name")
{
btnSearch.Text = user.UserName;
break;
}
}
}
-------------------------------------Search Profile-----------------------------
http://www.hothelpdesk.com/ - Web Based Helpdesk, Customer Service, Customer Support Software