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
How to check if the Dataset has records ?
What does ado stand for in ado.net?
What are the core objects of ADO.NET?
Which is faster entity framework or ado.net?
What is connection in ado.net?
What is the difference between statement and preparedstatement interface?
can we create synonymn in ms access,sql server,my sql if so explain me with example
Define data adapter?
Explain the difference between sqlcommand object and command behavior object?
How to load multiple tables into a dataset?
What is difference between connected and disconnected architecture in ado.net?
List all the steps in order, to access a database through ado.net?
What is ado.net in mvc?
Does dapper use ado.net?
How to identify the controls which can be used for binding data?