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

What is partial class?

746


What is ole2 format?

693


What are the different execute methods of Ado.Net?

766


What is difference between datareader and dataadapter?

819


What are the namespaces used in ADO.Net to connect to a database?

827


Explain what is datagrid with an example?

834


What is openrowset?

728


What is the advantage of ado.net?

772


Explain the difference between ado and ado.net?

714


Which keyword is used to accept variable number of parameters?

892


Why edit is not possible in repeater?

721


How to enable and disable connection pooling?

758


What is DataRowCollection?

853


Which is faster sqldataadapter and sqldatareader?

720


What does ole stand for in excel?

866