Click here to Skip to main content
11,926,429 members (60,683 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Windows Application
I want to check users selected security question and answer is matched with its database value which he is stores in sql server at the time registration.
Thank you,
Posted 2-Sep-12 19:43pm
pradiprenushe 3-Sep-12 1:05am
What is problem then?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


I understand what you want to do. but you also need to show what you have done so far. Anyway,

In your UserMaster table, you can create one flag(IsSecurityQuestionEnabled) indicating if user have checked Security Question or not. If so, you can create one another table(UserSecurityQuestion) with information about Question and Answer of that user.

While any user would like to change his/her password, you can prompt for Security question depending upon the flag you have defined in your UserMaster table.

For matching your security question and answer, you can write one StoredProcedure. StoredProcedure should contains all those select statements for matching security IsSecurityQuestionEnabled flag and UserSecurityQuestion table information for that user.

Hoe you got your required information.
-Amit Gajjar
indrajeet jadhav 7-Sep-12 7:26am
yes sir..i write here 1 store proc .i pass parameter 'SecurityQuestion' and 'Answer' here but its still nt wrkng.
@amitgajjar 7-Sep-12 7:27am
can you post your sp code by improving questoin?
indrajeet jadhav 7-Sep-12 7:32am
ALTER PROCEDURE dbo.SelectSecurityQueAndAnswerFromUserDetails

@SecurityQuestion nvarchar(MAX),
@Answer nvarchar(50)

select * from UserDetails where(SecurityQuestion=@SecurityQuestion and Answer=@Answer)
@amitgajjar 7-Sep-12 7:34am
Instead of returning select query return count of the selected rows. if it returns 1 then success otherwise fail.
indrajeet jadhav 7-Sep-12 7:34am
and the code i write a method here...
public DataTable SelectSecurityQueAndAns()
DataTable dtCheckSecQue = new DataTable();
DAL.UserDetailTableAdapters.SelectSecurityQueAndAnswerFromUserDetailsTableAdapter objCheckSec = new DAL.UserDetailTableAdapters.SelectSecurityQueAndAnswerFromUserDetailsTableAdapter();
//dtCheckSecQue = objCheckSec.SelectSecurityQueAndAnswerFromUserDet(UserId);
dtCheckSecQue = objCheckSec.SelectSecurityQueAndAnswerFromUserDet(SecurityQuestion,Answer);
catch (Exception ex)

return dtCheckSecQue;
indrajeet jadhav 7-Sep-12 7:35am
yes sir i write here IsActive 1 at the end of procedure.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100