Alright, so let me explain the details first.
I have two tables. One is the default aspnet_users table that themembership class builds. that has GUID, username, lowereduser, and such.
then I have another table called "UserSkills". That stores the GUID of the member, then the skills they have. so in that table i have. userID as GUID, then about 12 languages in 'bit' format.. (thats becuase in the webpage when they fill out there profile, all these are checkboxes. Basically all of the info is here http://www.listofcoders.com/profile.aspx?name=fenixsn. so there are a couple of bit fields, 1 text, and couple of varchars.
anways, so i wanna build a powerful search thingy. where the users have the option to search a user that only does for ex say php, asp, asp.net. and is from location "Canada". ok so when they fill out the info, I want my SQL statement to do the following
search the userskills table for the required fields. there might be more then 1 person that has the same profile, but different GUID. and then maybe using "Join" or another sql statement, grab there username, and last activity date from the users table that memberhship createes.
so in short, how do i make a dynamic sql statement.
anyone can help me out here?|||anyone help me pleas|||
Hi masfenix,
If you're trying to search according to the user input, you will need to use a WHERE clause after SELECT statement.
SELECT * FROM Table1 WHERECountry=@.Country ANDSkill=@.Skill
If the skill is not in the same table, you can use a JOIN
SELECT *,Skill.SkillName FROM Table1 LEFT OUTER JOIN Skill ON Table1.SkillID = Skill.SkillID WHERE .....
In your page code, pass the criterias through parameters and the expected result will be returned.
|||Hi, I wanna make a SPROC out of this.
how do I write the select statement then RETURN THE DATA (there could be more then 1 row returend).
and how do i read that data and put it in a gridview?
No comments:
Post a Comment