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

Does ado.net use odbc?

525


What is variable view?

497


How to connect and retrieve data from database using dataset

540


How to create data relations?

550


Explain the various objects in dataset.

528






What are the different ado.net namespaces?

624


Does executenonquery return a value?

543


Why ca not we use multiple inheritance and garbage collector paralelly in .net?

555


What is sql command in ado net?

503


Explain sqlconnection object?

536


Describe briefly an ADO.NET Dataset ?

551


Why edit is not possible in repeater?

524


Do we use stored procedure in ADO.Net?

574


What are the Data providers in ADO.Net?

555


What is the return type of executescalar?

495