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 ado.net and its architecture?
Explain how to pass multiple tables in datasets simultaneously?
What are the important features of ado.net 2.0?
What is Dataset Object?
What is the difference between Data adaptor and Data set?
What is ado.net code?
Which provider is used to connect ms access, oracle, etc…?
Explain how can we load multiple tables in to dataset?
How to pass values into a datatable?
What are the steps you will take to improve performance? Will you use dataset or datareader?
What Is Difference Between Ado And Ado.net?
What is partial class?
Explain About ado.net components/objects. Usage of data adapters and tell the steps to retrieve data.
What is openrowset?
What are the advantages of ado.net?