Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is execute reader in ado.net?

919


What is ado object model?

905


What is the difference between dataset and datatable?

955


What is meant by ‘transaction’ in a database and what are the ‘properties of transaction’?

958


What is ole db query?

933


Is entity framework better than ado.net?

947


What is sqldatareader?

886


How can we load multiple tables in to dataset?

1047


Which object needs to be closed?

2206


What is ado oledb and odbc?

889


If a table contains 20000 records. In a page at each time 100 records to be displayed.

853


Which database is the ado.net sql connection object designed for?

1009


What provider ado.net use by default? Explain the role of data provider in ado.net?

939


What does executereader return?

913


What is openrowset?

932