| | |
how can i get the column values
Please support our MS SQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2009
Posts: 52
Reputation:
Solved Threads: 0
hi,
i need to get the column values from the table login.it contais two columns ,userid and password. i want to check the userid and password values when the user logged in.so i have to compare the entered textbox value with the saved value. i am using the code is shown below.
i am using the asp.net(C#.net )with sql server..
so can u tell me the solution for that.
i need to get the column values from the table login.it contais two columns ,userid and password. i want to check the userid and password values when the user logged in.so i have to compare the entered textbox value with the saved value. i am using the code is shown below.
MS SQL Syntax (Toggle Plain Text)
rdr=cmd.executereader(); while(rdr.READ()) { IF(txtbox1.text==rdr[0]) IF(txtbox2.text==rdr[0]) msg(" successfully loggedin"); }
so can u tell me the solution for that.
Last edited by peter_budo; Aug 17th, 2009 at 4:45 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Why dont you include the parameters in the select statement something like
Take care.
MS SQL Syntax (Toggle Plain Text)
string st = "select user, pass from loggin where user = '"+txtbox1.text+"' and pass = '"+txtbox2.text+"'"; //Then pass that SELECT TO the command object rdr=cmd.executereader(); IF(rdr.HasRows) { msg(" successfully loggedin"); }
Take care.
If your already resolved your issue, flag it as solved.
José Bisonó
José Bisonó
You do not want to bring the password back in a select statement for security reasons. Do what jbisono suggested and send the data to the database. If you try to select the user "Where username = @username and password = @password" then it will return 0 rows since the password did not match, thus the login failed. If you have a row then the login was OK.
![]() |
Similar Threads
- Help with sql to select fields with equal values (MS SQL)
- Update the null values of a particular column (MS SQL)
- Combo column width problem (Visual Basic 4 / 5 / 6)
- arrange values from row of database in php from max to min, from min to max and value (PHP)
- GridView Change Color to Column Values (ASP.NET)
- INSERT VALUES (HTML CODE) problems! (MySQL)
- how to change values of particular column in datagrid... (VB.NET)
Other Threads in the MS SQL Forum
- Previous Thread: sql stored procedure rounding off?
- Next Thread: Website Form -> SQL Database injection help/guide?
Views: 487 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last age autogrowth business connectingtodatabaseinuse count cursor data database dateadd datediff datepart day" dbsize deadlock delete_trigger exploit getdate hack highperformancecomputing hpc hpcserver2008 ibm iis limit live loop maximum microsoft ms mssql multiple multithreading news number password permission position query reporting result security server services sets single source sql sql-injection sqlserver sqlserver2005 subtype supercomputing supertype tables uniqueid update view weekday






