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 / sonj

dim qry as string = SELECT name,password FROM compare where
name = '" + txtName.text + "' AND password = '" +
txtPassword.txt + "'"

Dim ConectionString As String = "User ID=xxx;Password = yyy;
Initial Catalog='" + DataBaseName + "';Data Source=<System No>"

dim con as SqlConnection = New SqlConnection(ConectionString )
con.open

dim cmd as SqlCommand = new SqlCommand(qry,con)
dim dr as SqlDataReader = cmd.ExectueReader

if dr.HasRows = True then
messagebox.show("User ID Found")
else
messagebox.show("User ID Not Found")
end if

Above is the one example. There are various ways to validate
fox example you can write a stored procedure to validate
ID,Password and avoid SQL Injection etc.,

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define partial class?

512


What is ado.net code?

523


Which method is used to sort the data in ADO.Net?

1508


What is connected architecture in ado.net?

526


What is difference between sqldatareader and sqldataadapter?

489






What is ado asp?

515


What is ole2 format?

504


What providers does Ado.net uses?

576


Is datareader faster than datatable?

543


Compare Data Reader & Dataset in ado.net?

548


What is commandbuilder in ado.net?

526


What does executenonquery () method return?

502


What are the core objects of ADO.NET?

588


What is sqlconnection and sqlcommand?

522


What does datareader object do?

541