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
How to add a javaScript function in a datagrid?
What are the core objects of ADO.NET?
Does ado.net use odbc?
What is ado.net connection?
Which is the best method to get two values from the database?
What is datatable in ado.net?
Why edit is not possible in repeater?
What are dataproviders?
What is sqlconnection and sqlcommand?
Define the executescalar method?
What is data view and variable view?
What do you mean by ‘batch updates’?
How is it possible to get 2 tables of data at a time by using data reader?
What is the difference between executenonquery () and executescalar ()?
What is the full form of ado?