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 / deepak,the infotech icon
sqlConnection con=new sqlConnection();
con.Connectionstring="Data source=servername;Initial
Catalog=databasename;Integrated Security=sspi";
con.open();
string query="SELECT * FROM tablename where name=@name AND
password=@password";
sqlCommand cmd=new sqlCommand(query,con);
cmd.parameters.add(new sqlparameters(@name,textbox1.text));
cmd.parameters.add(new sqlparameters(@password,textbox2.text));
sqlDataReader dr=cmd.Executereader();
while(dr.read())
{
if((textbox1.text==dr[0])&&(textbox2.text==dr[1]))
{
Messagebox.show("YOU ARE SUCCESSFULLY LOGED IN");
return;
}
}
Messagebox.show("INVALID USERNAME OR PASSWORD");
| Is This Answer Correct ? | 2 Yes | 5 No |
Post New Answer View All Answers
What is ado.net object model?
What are the Data providers in ADO.Net?
How to enable and disable connection pooling?
What is a datagridview?
What is a dataview?
Describe connection object in ado.net
What is the use of data grid?
Explain the basic use of "dataview" and explain its methods.
What is adodb dll?
What is the default Timeout for SqlCommand.CommandTimeout property?
Define data adapter?
oledbdataadpter with ms access in c#.net giving exception System.Data.OleDb.OleDbException while writing adapter.update(dataset,"tabname"); how to update the database from dataset?
What is ado or jdbc?
What is data view and variable view?
What is difference between connected and disconnected architecture in ado.net?