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 is shadow copy?

759


What is connection pooling and what is the maximum pool size in ado.net connection string?

720


What are dataproviders?

729


What is the difference between sqldatareader and sqldataadapter?

711


What is the difference between an ADO.NET Dataset and an ADO Recordset?

797


What is difference between executenonquery and executequery?

701


What is the difference between data grid and data repeater?

753


What is the default Timeout for SqlCommand.CommandTimeout property?

737


What is a datagridview?

733


What are the rules to implement connection pooling?

749


What are the ado.net components?

756


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

805


What are the different row versions available in table?

727


Explain ODP.net

766


Which object holds only data and does not interact with data source?

722