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 is partial class?
What is ole2 format?
What are the different execute methods of Ado.Net?
What is difference between datareader and dataadapter?
What are the namespaces used in ADO.Net to connect to a database?
Explain what is datagrid with an example?
What is openrowset?
What is the advantage of ado.net?
Explain the difference between ado and ado.net?
Which keyword is used to accept variable number of parameters?
Why edit is not possible in repeater?
How to enable and disable connection pooling?
What is DataRowCollection?
Which is faster sqldataadapter and sqldatareader?
What does ole stand for in excel?