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

Define data adapter?

713


What is an ado?

750


Which is better ole db or odbc?

697


How would you connect to a database by using .NET?

724


Explain ODP.net

785


Define table relations?

757


Explain the difference between ado and ado.net?

714


Do you use stored procedure in ado.net?

789


What is a datagridview?

754


What is ado.net full form?

759


What you mean by filtering of data?

732


Explain the different row versions available in table?

764


Which keyword is used to accept variable number of parameters?

890


What is the difference between Response.Expires and Reponse.ExpiresAbsolute?

809


Does ado.net use odbc?

718