sam71
12-28-2011, 08:04 AM
I am new to Java and getting a run time error in sql statement in the java code.
Below is the test code. I want to select the row from CUSTOMER table where CUSTLOGINID = "abc"
String username = "abc";
String sqlText = "select CustId, CustLoginId, CustPassword from javaDB.Customer where custLoginId = ";
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sqlText + " '+username+' ");
Please advice what is wrong in above code.
Thanks
Below is the test code. I want to select the row from CUSTOMER table where CUSTLOGINID = "abc"
String username = "abc";
String sqlText = "select CustId, CustLoginId, CustPassword from javaDB.Customer where custLoginId = ";
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sqlText + " '+username+' ");
Please advice what is wrong in above code.
Thanks