Hello Everyone

hello everyone, i am a student from singapore doing my project on jsp, can't seem to find the java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
This is my code
<%@ page import = "java.sql.*" %>
<%@ page import = "java.util.*" %>
<HTML>
<HEAD><TITLE>CUSTOMER RECORDS</TITLE>
</HEAD>
<BODY>
<H2>Please Fill in the New Customer Records</H2>
<TABLE BORDER=1 WIDTH="300" CELLPADDING=0 CELLSPACING=2>
<FORM ACTION="AddCustomer.jsp" METHOD="POST">
<TR><TD>Customer ID</TD><TD> <INPUT TYPE=TEXT NAME=custid></TD></TR>
<TR><TD>Company Name</TD><TD> <INPUT TYPE=TEXT NAME=compname></TD></TR>
<TR><TD>First Name</TD><TD> <INPUT TYPE=TEXT NAME=fname></TD></TR>
<TR><TD>Last Name</TD><TD><INPUT TYPE=TEXT NAME=lname></TD></TR>
<TR><TD>Billing Address</TD><TD><INPUT TYPE=TEXT NAME=badd></TD></TR>
<TR><TD>City</TD><TD> <INPUT TYPE=TEXT NAME=city></TD></TR>
<TR><TD>State/Province</TD><TD> <INPUT TYPE=TEXT NAME=statep></TD></TR>
<TR><TD>Post Code</TD><TD> <INPUT TYPE=TEXT NAME=pcode></TD></TR>
<TR><TD>Country</TD><TD><INPUT TYPE=TEXT NAME=country></TD></TR>
<TR><TD>Phone Number</TD><TD><INPUT TYPE=TEXT NAME=pnumber></TD></TR>
<TR><TD>Fax Number</TD><TD> <INPUT TYPE=TEXT NAME=fnumber></TD></TR>
<TR><TD>Email</TD><TD> <INPUT TYPE=TEXT NAME=email></TD></TR>
<TR><TD>Different Ship Address</TD><TD> <INPUT TYPE=checkbox NAME=diffsadd></TD></TR>
<TR><TD>Ship Company Name</TD><TD><INPUT TYPE=TEXT NAME=scompname></TD></TR>
<TR><TD>Ship First Name</TD><TD><INPUT TYPE=TEXT NAME=sfname></TD></TR>
<TR><TD>Ship Last Name</TD><TD> <INPUT TYPE=TEXT NAME=slname></TD></TR>
<TR><TD>Ship Address</TD><TD> <INPUT TYPE=TEXT NAME=sadd></TD></TR>
<TR><TD>Ship City</TD><TD> <INPUT TYPE=TEXT NAME=scity></TD></TR>
<TR><TD>Ship State/Province</TD><TD><INPUT TYPE=TEXT NAME=sstatep></TD></TR>
<TR><TD>Ship Post Code</TD><TD><INPUT TYPE=TEXT NAME=spcode></TD></TR>
<TR><TD>Ship Country</TD><TD> <INPUT TYPE=TEXT NAME=scountry></TD></TR>
<TR><TD>Ship Phone Number</TD><TD> <INPUT TYPE=TEXT NAME=spno></TD></TR>
<TR><TD>Ship Fax Number</TD><TD> <INPUT TYPE=TEXT NAME=sfno></TD></TR>
<TR><TD>Ship Email</TD><TD><INPUT TYPE=TEXT NAME=semail></TD></TR>
<TR><TD>Notes</TD><TD><INPUT TYPE=TEXT NAME=notes></TD></TR>
<TR><TD><INPUT TYPE=Submit VALUE="Add to Database"></TD></TR>
</FORM>
</TABLE>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connection = DriverManager.getConnection("jdbc:odbc:db","","");
Statement statement = connection.createStatement();
Enumeration parameters = request.getParameterNames();
if(parameters.hasMoreElements())
String custid = request.getParameter("custid");
String compname = request.getParameter("compname");
String fname = request.getParameter("fname");
String lname = request.getParameter("lname");
String badd = request.getParameter("badd");
String city = request.getParameter("city");
String statep = request.getParameter("statep");
String pcode = request.getParameter("pcode");
String country = request.getParameter("country");
String pnumber = request.getParameter("pnumber");
String fnumber = request.getParameter("fnumber");
String email = request.getParameter("email");
String diffsadd = request.getParameter("diffsadd");
String scompname = request.getParameter("scompname");
String sfname = request.getParameter("sfname");
String slname = request.getParameter("slname");
String sadd = request.getParameter("sadd");
String scity = request.getParameter("scity");
String sstatep = request.getParameter("sstatep");
String spcode = request.getParameter("spcode");
String scountry = request.getParameter("scountry");
String spno = request.getParameter("spno");
String sfno = request.getParameter("sfno");
String semail = request.getParameter("semail");
String notes = request.getParameter("notes");
try{
statement.executeUpdate("INSERT INTO Customers(Customer ID,Company Name,First Name,Last Name,Billing Address,City,StateProvince,Post Code,Country,Phone Number,Fax Number,Email,different ship address,Ship Company Name,Ship First Name,Ship Last Name,Ship Address,Ship City,Ship StateProvince,Ship Post Code,Ship Country,Ship Phone Number,ShipFax Number,Ship Email,Notes) VALUES ('"+custid+"','"+compname+"','"+fname+"','"+lname+"','"+badd+"','"+city+"','"+statep+"','"+pcode+",''"+country+"',''"+pnumber+"',''"+fnumber+"',''"+email+"',''"+diffsadd+"',''"+scompname+"',''"+sfname+"',''"+slname+"',''"+sadd+"',''"+scity+"',''"+sstatep+"',''"+spcode+"',''"+scountry+"',''"+spno+"',''"+sfno+"',''"+semail+"',''"+notes+"')");
}catch(SQLException sqle)
out.println(sqle);
%>
<ALIGN=CENTER>Click here to go back to Staff's MainPage
</BODY>
</HTML>
Please help me. Thank you very much sorry for any inconvenience caused.
Cheers
mvp

Welcome to the Sun forums.
1. Please post your code using code tags, this formats it so that it is easier for people to read and understand it. Click on 'CODE' above the text area when posting.
2. As far as possible, please post an SSCCE
3. Please give complete information, your current post is missing the actual error stack trace. If required, use [Exception#printStackTrace()|http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Throwable.html#printStackTrace()] to get the complete stack trace.
4. Please don't paraphrase errors or type in code from memory. This tends to mask the actual error and introduce additional problems. Copy-paste your stacktrace and/or code.

Similar Messages

Maybe you are looking for

  • Adobe Flash Player Installer/Uninstaller 11.5 r502 has encountered a problem and needs to close...

    I'm baaaaaack... Woke up this morning to a Flash Player update, performed the update and got this error message for my troubles.  I thought you had this problem fixed. Copied from cf48_appcompat.txt: <?xml version="1.0" encoding="UTF-16"?> <DATABASE>

  • Custom fields not display in SRM5.5 Basic Data Frame

    Hello Everybody,       I am working on SRM5.5 Server which i have to add two custom fields in Basic Data Frame..      No field is display in basic data frame After I added those fields in INCL_EEW_PD_ITEM_CSF_SC and INCL_EEW_PD_ITEM_CSF.     I added

  • How to put a default value in Search Pages

    Hi Guru's, I've been trying to look for a way to default the Parameters of a search page (i.e. in Opportunity search, component BT111S_OPPT i want the search parameter PROSPECT_NAME defaulted to a certain value). I've tried using both INSERT_SELECTIO

  • Issue in creating sales order with ref contract(quantity)

    hi friends,        I am creating sales order with reference contract using "BAPI_SALESORDER_CREATEFROMDAT1" my issue is with quantity field when i am entering quantity as  1 then it is taking as 0.001 i am also declaring its unit field too but there

  • Error Message while doing F-51 (Post with Clearing)

    Hi All, We are getting an error message as  "Consolidated companies " " & 009062 are diff" while executing F-51 (Post with Clearing). While executing F-51 we are using the document type as KG. Can you please let us know the possible reasons for such