Bug fix in sample code

This commit is contained in:
malikashish8 2018-10-26 22:29:44 +11:00 committed by Nanne Baars
parent 5921a06747
commit 6699456ee1

View File

@ -11,7 +11,7 @@ PreparedStatement ps = null;
RecordSet rs = null; RecordSet rs = null;
try { try {
pUserName = request.getParameter("UserName"); pUserName = request.getParameter("UserName");
if ( isUsernameValid (pUsername); if ( isUsernameValid (pUsername) ) {
ps = conn.prepareStatement("SELECT * FROM user_table ps = conn.prepareStatement("SELECT * FROM user_table
WHERE username = ? "); WHERE username = ? ");
ps.setString(1, pUsername); ps.setString(1, pUsername);
@ -22,4 +22,4 @@ try {
} else { // handle invalid input } } else { // handle invalid input }
} }
catch (…) { // handle all exceptions … } catch (…) { // handle all exceptions … }
---- ----