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 / suchit kumar dash

Dim con as new SqlConnection
Dim cmd as new SqlCommand
Dim dr as SqlDataReader
Dim str,str1 as String
Dim I_Int as Integer=0

PageLoad
--------------
str="Server=......;Database=......;Trusted_Connection=Yes;User
Id=sa;Password=sa;"
con=new SqlConnection(str)

Login BUtton
--------------
str1="select * from TableName where User_Name='"&
TextBox1.Text &"' and Password='" & TextBox2.Text &"'"
cmd=New SqlCommand(str1,con)
dr=cmd.ExecuteReader
while(dr.Read())
i_int=i_int+1
End while
if i=0 then
MessageBox.Show("Please Enter correct User Id and Password")
else

Endif

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how to call the sql commands asynchronously in ado.net version 2.0?

511


Explain the role of data provider in ado.net? What is the role of data provider in ado.net?

528


I loaded the dataset with a table of 10 records. One of the records is deleted from the backend, how do you check whether all the 10 records were present while updating the data(which event and steps) and throw the exception 28 can datareader hold data from multiple tables?

553


Describe briefly an ADO.NET Dataset ?

552


How we can provide data to ado.net?

547






What are the ado.net components?

527


Which name space is used to get assembly details?

525


What is ado.net code?

523


how we can fire event in databound coulm in datagfrid withot using button?

574


What are ado.net objects?

531


What is the difference between executequery and executenonquery?

508


What is aggregate root?

494


How can we check that some changes have been made to dataset since it was loaded?

518


Define the data provider classes that is supported by ado.net?

521


Define executenonquery?

527