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

Why ca not we use multiple inheritance and garbage collector paralelly in .net?

546


Explain which name space is used to get assembly details?

522


How will you fill the gridview by using datatable object at runtime?

546


What is DataReader Object?

588


The answers which posted above is not satisfied my requirement? Can some one post teh exact answer? Thanx

1568






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

550


How to check if the Dataset has records ?

528


What is executequery?

492


Explain how can we load multiple tables in to dataset?

493


List the 4 common ado.net namespaces?

697


Which object needs to be closed?

1736


What property must be set and what method must be called in your code to bind the data from some data source to the Repeater control?

552


What is the difference between data grid and data repeater?

500


How to enable and disable connection pooling?

501


What are the different execute methods of Ado.Net?

549