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

What do you know about ado.net's objects?

733


What is variable view?

685


What are the usages of the command object in ado.net?

782


What is ado and rdo?

705


Which one of the following objects is a high-level abstraction of the connection and command objects in ado.net?

845


Explain the advantages and disadvantages of using datalist?

819


How can we add relation between tables in a dataset?

769


What are the namespaces used in ADO.Net to connect to a database?

826


What is the difference between Command and CommandBuilder object?

806


What is an ado?

750


Explain the difference between an ado.net dataset and an ado recordset?

795


How do I delete a row from a DataTable?

801


Which architecture does Datasets follow?

815


Explain the basic use of "dataview" and explain its methods.

726


What is ole in excel?

727