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
Why ca not we use multiple inheritance and garbage collector paralelly in .net?
Explain which name space is used to get assembly details?
How will you fill the gridview by using datatable object at runtime?
What is DataReader Object?
The answers which posted above is not satisfied my requirement? Can some one post teh exact answer? Thanx
Explain About ado.net components/objects. Usage of data adapters and tell the steps to retrieve data.
How to check if the Dataset has records ?
What is executequery?
Explain how can we load multiple tables in to dataset?
List the 4 common ado.net namespaces?
Which object needs to be closed?
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?
What is the difference between data grid and data repeater?
How to enable and disable connection pooling?
What are the different execute methods of Ado.Net?