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 are the differences between OLEDB and SQLClient Providers?

573


What are the different layers of ado.net?

524


What is a datagridview?

523


What are the Data providers in ADO.Net?

563


What are ado.net objects?

542






What are the drawbacks of using ado.net?

551


What is difference between ado.net and asp net?

522


What are all the commands used with Data Adapter?

526


Is it possible to load multiple tables in a Dataset?

538


What is sql command in ado net?

510


What is the current version of entity framework?

494


What is data view and variable view?

493


What are the different row versions available in table?

537


How do you find the count of records in a dataset?

486


What is variable view?

501