dharmer1975
Programmer
What's the difference between between these two statements--they appear to do the same thing, but the second one doesn't work:
CallableStatement cs = con2.prepareCall("{call harmerd.FERPmonthlybyregion (?, 'CL%')}"
cs.setString(1, "harmerd." + timeperiod);
CallableStatement cs = con2.prepareCall("{call harmerd.FERPmonthlybyregion (?,?)}"
cs.setString(1, "harmerd." + timeperiod);
cs.setString(2, "CL%"
------------------
I ideally want to do this to set the second parameter:
String region = (request.getParameter("Region");
cs.setString(2, "region"
(region would have a string value of 'CL%'
Here's the error I get when using setString to set both paramters instead of hardcoding the second one:
SQLException caught: [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string 'CL% '. [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'CL% '.
Can somebody please help me--I've been stuck for 2 days now Thanks,
Dan
CallableStatement cs = con2.prepareCall("{call harmerd.FERPmonthlybyregion (?, 'CL%')}"
cs.setString(1, "harmerd." + timeperiod);
CallableStatement cs = con2.prepareCall("{call harmerd.FERPmonthlybyregion (?,?)}"
cs.setString(1, "harmerd." + timeperiod);
cs.setString(2, "CL%"
------------------
I ideally want to do this to set the second parameter:
String region = (request.getParameter("Region");
cs.setString(2, "region"
(region would have a string value of 'CL%'
Here's the error I get when using setString to set both paramters instead of hardcoding the second one:
SQLException caught: [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string 'CL% '. [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'CL% '.
Can somebody please help me--I've been stuck for 2 days now Thanks,
Dan