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 / boopathiraj

sqlconnection con = new sqlconnection("");
sqlcommand cmd = new sqlcommand("select * from
table-name",con);

//write this code in the button click event
con.open();
dr = cmd.executereader();
while(dr.read())
{
if(textbox1.text==dr.getvalue(0).tostring()&&
textbox2.text==dr.getvalue(1).tostring())
{
msgbox.show("successful");
}
}
con.close();
else
{
msgbox.show("not success");
}

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the various objects in dataset.

522


How can we load multiple tables in a dataset?

533


Define Execute Scalar?

547


What is the difference between sqlcommand and sqldataadapter?

491


What is executequery?

492






How to pass values into a datatable?

590


What are the namespaces used in ado.net for data access?

474


Explain the difference between ado and ado.net?

498


How to identify the controls which can be used for binding data?

539


Can we load multiple tables in a dataset?

536


What is the hierarchy of data in databases?

494


What are the advantage of ado.net?

512


What is the meaning of object pooling?

586


What does executequery return?

512


Explain the differences between oledb sql server, oledbdotnet provider?

548