pwinters
Programmer
- Sep 12, 2002
- 34
PLEASE HELP....Here is my code:
<%
String initnum = request.getParameter("initnum"
;
String pname = request.getParameter("projname"
;
String status = request.getParameter("primstatus"
;
String stage = request.getParameter("projstage"
;
String month = request.getParameter("relmonth"
;
String spm = request.getParameter("spmid"
;
String pdesc = request.getParameter("desc"
;
if ((pdesc == null) || (pdesc.equalsIgnoreCase("null"
))
pdesc = "";
String adjtnum = request.getParameter("adjnum"
;
if ((adjtnum == null) || (adjtnum.equalsIgnoreCase("null"
))
adjtnum = "";
String adjtstat = request.getParameter("adjstatus"
;
if ((adjtstat == null) || (adjtstat.equalsIgnoreCase("null"
))
adjtstat = "";
String adjtdesc = request.getParameter("adjdesc"
;
if ((adjtdesc == null) || (adjtdesc.equalsIgnoreCase("null"
))
adjtdesc = "";
String lloe = request.getParameter("loadloe"
;
if ((lloe == null) || (lloe.equalsIgnoreCase("null"
))
lloe = "";
String sql =
"INSERT INTO Projects " +
"( " +
"Initiative_Num, " +
"Project, " +
"Release, " +
"SPM_ID, " +
"Project_Stage, " +
"Primary_Status, " +
"Description, " +
"Adj_Num, " +
"Adj_Status, " +
"Adj_Description, " +
"Loaded_LOE " +
"
" +
"VALUES " +
"( " +
db.formatInsertStringValue(initnum, true) + "," +
db.formatInsertStringValue(pname, true) + "," +
db.formatInsertStringValue(month, true) + "," +
db.formatInsertStringValue(spm, true) + "," +
db.formatInsertStringValue(stage, true) + "," +
db.formatInsertStringValue(status, true) + "," +
db.formatInsertStringValue(pdesc, true) + "," +
db.formatInsertStringValue(adjtnum, true) + "," +
db.formatInsertStringValue(adjtstat, true) + "," +
db.formatInsertStringValue(adjtdesc, true) + "," +
db.formatInsertStringValue(lloe, true) + "," +
"
";
int rowsAffected = db.execUpdate(sql);
//int rowsAffected = 2;
if (rowsAffected == 1)
{
response.sendRedirect("../site/epsmain_form.jsp"
;
}
else
{
%>
<h2>Sorry, modification has failed.</h2>
<%= sql %>
<p><a href="../site/epsmain_form.jsp">Back to Main</a>
<%
}
%>
I can't figure out what the problem is. When I enter the information on the form (in webpage), I get an error:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in INSERT INTO statement.
Can anyone PLEASE help me figure out what is wrong. I've been looking at this and trying things for 5 days now, and nothing seems to be working.
Thanks so much.
p.s. using MSAccess 97 db with web front end.
<%
String initnum = request.getParameter("initnum"
String pname = request.getParameter("projname"
String status = request.getParameter("primstatus"
String stage = request.getParameter("projstage"
String month = request.getParameter("relmonth"
String spm = request.getParameter("spmid"
String pdesc = request.getParameter("desc"
if ((pdesc == null) || (pdesc.equalsIgnoreCase("null"
pdesc = "";
String adjtnum = request.getParameter("adjnum"
if ((adjtnum == null) || (adjtnum.equalsIgnoreCase("null"
adjtnum = "";
String adjtstat = request.getParameter("adjstatus"
if ((adjtstat == null) || (adjtstat.equalsIgnoreCase("null"
adjtstat = "";
String adjtdesc = request.getParameter("adjdesc"
if ((adjtdesc == null) || (adjtdesc.equalsIgnoreCase("null"
adjtdesc = "";
String lloe = request.getParameter("loadloe"
if ((lloe == null) || (lloe.equalsIgnoreCase("null"
lloe = "";
String sql =
"INSERT INTO Projects " +
"( " +
"Initiative_Num, " +
"Project, " +
"Release, " +
"SPM_ID, " +
"Project_Stage, " +
"Primary_Status, " +
"Description, " +
"Adj_Num, " +
"Adj_Status, " +
"Adj_Description, " +
"Loaded_LOE " +
"
"VALUES " +
"( " +
db.formatInsertStringValue(initnum, true) + "," +
db.formatInsertStringValue(pname, true) + "," +
db.formatInsertStringValue(month, true) + "," +
db.formatInsertStringValue(spm, true) + "," +
db.formatInsertStringValue(stage, true) + "," +
db.formatInsertStringValue(status, true) + "," +
db.formatInsertStringValue(pdesc, true) + "," +
db.formatInsertStringValue(adjtnum, true) + "," +
db.formatInsertStringValue(adjtstat, true) + "," +
db.formatInsertStringValue(adjtdesc, true) + "," +
db.formatInsertStringValue(lloe, true) + "," +
"
int rowsAffected = db.execUpdate(sql);
//int rowsAffected = 2;
if (rowsAffected == 1)
{
response.sendRedirect("../site/epsmain_form.jsp"
}
else
{
%>
<h2>Sorry, modification has failed.</h2>
<%= sql %>
<p><a href="../site/epsmain_form.jsp">Back to Main</a>
<%
}
%>
I can't figure out what the problem is. When I enter the information on the form (in webpage), I get an error:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in INSERT INTO statement.
Can anyone PLEASE help me figure out what is wrong. I've been looking at this and trying things for 5 days now, and nothing seems to be working.
Thanks so much.
p.s. using MSAccess 97 db with web front end.