i have two textboxes one for user name and another for
password . i have a table name compare(which contains
name,passwod etc.,)my doubt is how compare username
textbox with name column and how compare password textbox
with passwod column. i want the code

Answer Posted / anjaneyulu

U will compare the 2 textboxes values i.e.username &
password with the database values by writing the following code:



cn.Open();
SqlCommand cmd = new SqlCommand("select count(*)
from compare where username='" + TextBox1.Text + "'and
password='" + TextBox2.Text + "'", cn);
int count = (int)cmd.ExecuteScalar();
cn.Close();
if (count != 0)
{
Page.RegisterStartupScript("pr",
"<script>alert('welcome to MS.Net')</script>");
}
else
{
Page.RegisterStartupScript("an",
"<script>alert('sorry')</script>");
}

Is This Answer Correct ?    16 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to check if the Dataset has records ?

534


What does ado stand for in ado.net?

458


What are the core objects of ADO.NET?

588


Which is faster entity framework or ado.net?

501


What is connection in ado.net?

534






What is the difference between statement and preparedstatement interface?

563


can we create synonymn in ms access,sql server,my sql if so explain me with example

1583


Define data adapter?

513


Explain the difference between sqlcommand object and command behavior object?

536


How to load multiple tables into a dataset?

544


What is difference between connected and disconnected architecture in ado.net?

587


List all the steps in order, to access a database through ado.net?

587


What is ado.net in mvc?

501


Does dapper use ado.net?

598


How to identify the controls which can be used for binding data?

551