How to check Entered textbox value and database values are equal or not?

Posted by Mandlaa under ASP.NET on 6/6/2013 | Points: 10 | Views : 4939 | Status : [Member] | Replies : 2
I am enter Password in textbox After that check enter value and database value these 2 vales correct display message correct,Suppose not match dosplay incorrect,



I want to writr this code in Textboxcheckedchange event

How can i implement this one

Give me some code on this




Responses

Posted by: Mandlaa on: 6/12/2013 [Member] Starter | Points: 25

Up
0
Down
Without delete my actual code how can i validate this functionality?
please help me
 Download source file

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 6/14/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
use the below code to archive you task:-

.aspx.cs file

protected void Textboxcheckedchange(objectsender, EventArgs e)
{

SqlCommand com = new SqlCommand(query, con);
com.CommandType= CommandType.StoredProcedure;
com.Parameters.AddWithValue("@Password", TextBox2.Text.ToString()); //for password

int usercount = (Int32)com.ExecuteScalar();// for taking single value

if (usercount == 1) // comparing users from table
{
Response.Redirect("Welcome.aspx"); //for sucsseful login
}
else
{
con.Close();
Label1.Text = "Invalid User Name or Password"; //for invalid login
}
}

You need to check the password in you store procedure.

Hope this will help you.

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response