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 ado.net and its architecture?

717


Explain how to pass multiple tables in datasets simultaneously?

766


What are the important features of ado.net 2.0?

825


What is Dataset Object?

765


What is the difference between Data adaptor and Data set?

785


What is ado.net code?

715


Which provider is used to connect ms access, oracle, etc…?

738


Explain how can we load multiple tables in to dataset?

700


How to pass values into a datatable?

821


What are the steps you will take to improve performance? Will you use dataset or datareader?

744


What Is Difference Between Ado And Ado.net?

768


What is partial class?

738


Explain About ado.net components/objects. Usage of data adapters and tell the steps to retrieve data.

789


What is openrowset?

707


What are the advantages of ado.net?

683