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
What are good ado.net object to replace to ado recordset object.
How can we check that some changes have been made to dataset since it was loaded?
What is the difference between an ADO.NET Dataset and an ADO Recordset?
What are the key events of sqlconnection class?
How to creating a SqlCommand Object?
What is datatable in ado.net?
How can we serialize the dataset object?
Which one of the following objects is a high-level abstraction of the connection and command objects in ado.net?
What is ado and dao?
What is ambient transaction?
What is typed dataset ?
Is ado.net dead?
Explain the advantage of ADO.Net?
What are all the different authentication techniques used to connect to MS SQL Server?
What is the default timeout specified for "sqlcommand.commandtimeout" property?