Error in this  statement

This statement return an SQLException which says:
Syntax error in INSERT INTO statement
String mySql_1 = " INSERT INTO MEAL(MEAL_AMT_LOADED)"
"WHERE MEAL.STU_NUM = '" jtfStNo.getText().trim()
"'VALUES('"+jtfAmLd.getText().trim()+"')";
I want the following query statement to allow me to insert a meal amount of a particular student through jtfAmLd into the MEAL table whereby a student must be identified by a student number also to be provided in jtfStNo.
I'll be glad if you can help me with this statement
Cool.

I want to know how am i going to update the second table MEAL which
contains a foreign key STU_NUM which referenced STUDENT the table which contains STU_NUM as a primary key using the criteria of a STU_NUM.
Duffymo and DrClap i have tried UPDATE as follows:
String query = "UPDATE STUDENT,MEAL"+
"SET MEAL.MEAL_AMT_LOADED = '" + jtfAmLd.getText().trim() +"',"+
"MEAL.MEAL_REL_MADE = '"+jtfRM.getText().trim()+ "' "+
"WHERE STUDENT.STU_NUM = MEAL.STU_NUM"+
"AND STUDENT.STU_NUM = '" + jtfStNo.getText().trim() + "'";
But it returns an error which says:
Failed to insertjava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

Similar Messages

  • Error in this statement [import="com.oreilly.servlet.MultipartRequest"]

    hai,
    iam designing jsp page where i use thi class i.e.,
    import="com.oreilly.servlet.MultipartRequest"
    for this iam using j2ee server i istalled jdk and j2ee.
    when i run the following code iam getting error " unabe to compile class import="com.oreilly.servlet.MultipartRequest" "
    what else should i do
    please help me anyone
    code is
    <%@ page language="java" %>
    <%@ page import="java.text.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="javax.servlet.http.HttpSession" %>
    <%@ page import="java.util.*" %>
    <%@ page import="javax.servlet.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.net.*" %>
    <%@ page import="com.oreilly.servlet.MultipartRequest" %>
    <%@ page import="com.oreilly.servlet.ServletUtils" %>
    <%!
    String uri="";
    Vector files=new Vector();
    String pathf="";
    %>
    <%!
    public static String FORM_ACTION = "method";
    public static String ACTION_ATTACHFORM = "Attachments";
    public static String ACTION_ATTACHFILE = "AttachtoMessage";
    public static String ACTION_FILEREMOVE = "fileRemove";
    public static String ACTION_SEND = "Send";
    %>
    <%
    pathf=DNet.getDataFilesPath()+"/ActivityManagementNew";
    pathf=pathf+"/";
    uri=request.getRequestURI();
    HttpSession ss=request.getSession(true);
    String persno=(String)ss.getAttribute("persno");
    String method = request.getParameter(FORM_ACTION);
    //System.out.println("method"+method);
    if (method ==null) {
         else if((method!=null) && (method.equals(ACTION_ATTACHFORM)))
         attachForm(request, out, files,0);
         else if((method!=null) && (method.equals(ACTION_ATTACHFILE)))
         attachFile(request, out);
         else if((method!=null) && (method.equals(ACTION_FILEREMOVE)))
         removeFile(request, out);
    %>
    <%! int inc=0; %>
    <%!
    public void attachForm(HttpServletRequest req,JspWriter out,Vector files,int size)
    throws ServletException, java.io.IOException
    out.println("<html>");
    out.println("<head><LINK href=dmail.css rel=stylesheet>");
    out.println("<title> Attach File </title>");
    out.println("<Script Language=JavaScript>");
    out.println("list=new Array();");
    out.println("function putattach(pos,name) {");
    out.println(" list[pos]=name; }");
    out.println("function listattach() {");
    out.println("if((window.opener.document.composeform.list)!=null)");
    out.println("window.opener.document.composeform.list.value=list;");
    out.println("window.close();}");
    out.println("</script>");
    out.println("</head>");
    out.println("<body bgcolor='#EEEEEE' text='#494949' link='#9966CC' vlink='#009999' alink='#CC0066' ><center>");
    out.println("<table>");
    out.println("<TR align=middle bgColor=#eeeecc><TD colSpan=7 align=center><FONT class=f> <B>Attachments ");
    out.println("</B> </FONT></TD></TR>");
    out.println("</table>");
    out.println("<form action="+uri+"?method="+ACTION_ATTACHFILE+"&size="+size+" ENCTYPE=multipart/form-data method=post>"+
    "<center><table width=400 border=0><tr><td><ol>"+
    "<li><p>Click the <b>Browse</b> button to select the file that"+
         " you want to attach, or type the path to the file in the box below.<br>"+
         "Attach File: <input name=attfile type=file> </p>"+
         " </li><li><p>Click the <b>Attach to Message</b> button.<br>"+
         " The transfer of an attached file may require 30 seconds to up to 10 minutes.<br>"+
         "<center><input type=submit name=method value=\""+ACTION_ATTACHFILE+"\"></center></form></p>"+
         "</li> <li><p>Repeat Steps 1 and 2 to attach additional files. Click"+
         "the <b>Done</b> button to return to your message.</p></li></ol><br>"+
         "<center><Input type=button value=Done onClick=listattach()></center>"+
         "</td></tr></table>"+
         "<form method=post action="+uri+">"+
         "<input type=hidden name=size value="+size+">"+
         "<hr width=400><table width=400 border=0>"+
         "<tr><td><select name=attachlist size=5 multiple>");
         if(files!=null)
         for(int i=0;i<files.size();i++)
         out.println( "<option value="+i+">"+(String)files.get(i)+"</option>");
    out.println("</select>");
         out.println("<Script language=JavaScript>");
         for(int i=0;i<files.size();i++)
         out.println("putattach("+i+", '"+(String)files.get(i)+"')");
         out.println("</script>");
         out.println("</td><td><input type=hidden name=method value="+ACTION_FILEREMOVE+"><input type=submit value=Remove> </td></tr>");
         }else out.println("<option value=-1>-- Message Attachments -- </option></select>");
    out.println("<tr><td><b>Current total ="+size+"K</b></td></tr>"+
    "<tr><td colspan=2>Each file size cannot exceed 20MB. To remove an attachment,"+
    "select the file from the list and click the <b>Remove</b> button. </td>"+
    "</tr> </table></form></center>");
    out.println("</body></html>");
    out.flush();
    // out.close();
    public void attachFile(HttpServletRequest req,JspWriter out)
    throws ServletException, java.io.IOException
    HttpSession session=req.getSession();
    Vector files=(Vector)session.getValue("files");
         int Fsize=0;
         try{
         String user=(String)req.getSession().getValue("PERSONALNO");
         File f=new File(pathf+"/Temp/"+user);
         if(!f.exists())
         f.mkdir();
         MultipartRequest multi =new MultipartRequest(req, pathf+"/Temp/"+user, 20 * 1024 * 1024);
         Enumeration efiles = multi.getFileNames();
         String filename=null;
         Fsize=Integer.parseInt(req.getParameter("size"));
         while (efiles.hasMoreElements())
    String name = (String)efiles.nextElement();
         filename = multi.getFilesystemName(name);
         File ft=new File(pathf+"/Temp/"+(String)req.getSession().getValue("PERSONALNO")+"/"+filename);
         long size=ft.length();
         if(filename!=null)
         if(size<1024)
         Fsize=Fsize+1;
         else
         Fsize=Fsize+java.lang.Math.round((float)size/1024);
    if(files==null)
    files=new Vector(); // to keep track of attached files
         files.add(filename);
    session.putValue("files",files);
         attachForm(req,out,files,Fsize);
    catch(Exception e)
         e.printStackTrace();
    public void removeFile(HttpServletRequest req,JspWriter out)
    throws ServletException, java.io.IOException
    HttpSession session=req.getSession();
    Vector files=(Vector)session.getValue("files");
         int j;
         int FSize=Integer.parseInt(req.getParameter("size"));
         String st[]=req.getParameterValues("attachlist");
         String user=(String)req.getSession().getValue("PERSONALNO");
         if(st!=null)
         for(int i=0;i<st.length;i++)
         j=Integer.parseInt(st);
         File f=new File(pathf+"/Temp/"+user+"/"+(String)files.get(j));
         long s=f.length();
         if(s<1024) s=1;
         else s= java.lang.Math.round((float)s/1024);
         FSize=(int)(FSize-s);
    if(files==null)
    files=new Vector(); // to keep track of attached files
         files.remove(j);
    session.putValue("files",files);
         f.delete();
         if(files.size()==0)
         files=null;
         File f=new File(pathf+"/Temp/"+user);
         f.delete();
         attachForm(req,out,files,FSize);
    %>

    WEB-INF/classes or ClassPath?I meant WEB-INF/lib ... not WEB-INF/classes

  • Urgent Help Cant find an error in this statement and jdk is showing

    Error:
    Exception: [Microsoft][ODBC Microsoft Access Driver] Syntax error in CONSTRAINT clause.
    `````````````````H E L P```````````````
    s1.executeUpdate("Create Table " + n + " (Sno integer, Name varchar(20),So varchar(5),Source varchar(15), TTO integer, TTH integer, Status varchar(5), Rec varchar(15), DOJ Date, Type varchar(10), Sector varchar(15), Primary varchar(15), Proj varchar(15), Skills varchar(15), Level varchar(10), Band integer, Location varchar(15), Company varchar(20), Remarks varchar(50), Test date, IV date, Qualification varchar(15), RefSal float, RIF_NO integer, RIF_DATE Date, Target_Date Date, Lead_Time date, SLA_ACH Date, R1 date, R2 date, R3 date, R4 date,R5 date, R6 date, R7 date, R8 date, RR1 date,RR2 date, RR3 date, RR4 date,RR5 date, RR6 date, RR7 date, RR8 date)");
    I am using access as backend database on a remote machine.

    n is not a numeric data but is of string typeThat was just for your information because you didn't show any of your java code.
    Did you try changing the names of those columns? I haven't used access much, but i believe there is some workaround to using reserved words by putting square brackets aroundf them. I haven't done it, I just noticed the access gui front end does it sometimes. i found it much easier to just not use words I thought might be reserved.

  • Where is the error in this statement?

    stat.executeUpdate("insert into message("+"'login,destinateur,message'"+") values("+"'"+log+"','"+destinateur+"','"+message+")");

    stat.executeUpdate("insert into
    message("+"'login,destinateur,message'"+")
    values("+"'"+log+"','"+destinateur+"','"+message+")");
    stat.executeUpdate(
        insert into message(
      +
          login,destinateur,message
      +
        values(
      +
      + log +
      + destinateur +
      + message +
    );What is the problem with it?

  • Where is the errors in this statement?

    stat.executeUpdate("insert into message("+"'login,destinateur,message'"+") values("+"'"+log+"','"+destinateur+"','"+message+")");

    stat.executeUpdate("insert into
    message("+"'login,destinateur,message'"+")
    values("+"'"+log+"','"+destinateur+"','"+message+")");I notice two problems.
    1) in your field list your string will look like ('login,destinateur,message'). You need to get rid of the single quotes around the field names.
    2) You are missing a single quote after message at the end of the string: ...+message+")" instead of ...+message+"')"
    SQL statements tend to be somewhat difficult to debug. To help you might want to split them into two statements:
    String sql = "insert into...";
    stat.executeUpdate(sql);
    Then you can use a debugger (or insert a System.out.println) to see what the value of sql is before the statement is executed. Its easier to notice those little problems when you are seeing the final string with all of its values inserted.

  • Why do I keep getting an error with this statement

    var Incentive = this.getField("Incentive").value;
    var ETPC = this.getField("ETPC").value;
    if (Incentive =< ETPC)event.value = Incentive;
    else if (Incentive => ETPC)event.value = ETPC;

    That simple. works like a charm now. I can't thank you enough.

  • ASSIGN_REFERENCE_EXPECTED    error in assign statement.

    hi all,
    Iam upgrading the system from ecc4.6c to 6.0
    igot a dump in the assign statement.
    this is the statement:
      assign src+fields_int-offset_src(fields_int-length_src)
             to <f> type fields_int-type
             decimals fields_int-decimals.
    it is giving the error at this statament.
    error analysis is :
    The first operand specified with ASSIGN has type "14" and is therefore   
    no data reference.                                                       
    will anyone solve this problem.

    hi,
    increase the field length of fields_int-type or make use of a different field which has length greater tha or equal to fields_int-length_src field length.
    Regards,
    Santosh

  • I just downloaded itunes onto my new laptop and I am trying to burn songs onto a cd that I had purchased previously and I am getting an error message that states I must authorize this computer. What does that mean?

    I just downloaded itunes onto my new laptop and I am trying to burn songs onto a cd that I had purchased previously and I am getting an error message that states I must authorize this computer. What does that mean?

    If the computer's running Mac OS X, move the cursor to the very top of the computer's screen, click on Store, and choose Authorize this Computer.
    If the computer's running Windows, press the Alt and S keys and choose Authorize this Computer, or click here, follow the instructions, click on Store in the menu bar, and choose Authorize this Computer.
    (95452)

  • ​Error coming up states " warning some of the videos in your iTunes library including video "Dora" were  copied to the iPad "ellen's iPad " because they cannot be played on this

    I purchased tv shows for my son over 4th of July weekend from iTunes on my iPad...he has been watching with no problem...yeste​rday I backed up my iPad and the videos were taken off while I was syncing it. Error coming up states " warning some of the videos in your iTunes library including video "Dora" were not copied to the iPad "ellen's iPad " because they cannot be played on this iPad was not copied because the video format is not supported by the iPad.....makes no sense since he watched the video on Friday on my iPad...I went into the properties of the video and under the summary tab states kind of video is mpeg-4video file...went into the folder on my pc and the file is listed as a m4v file...under the tab tv shows when my iPad is connected I have it checked to sync tv shows and to automatically include "all" episodes of "all shows" ....
    I am using version 4.3.4 on my iPad and iTunes version 10.4 ...I even restored back to the original settings and still did not work....called apple twice yesterday and spoke to 2 different people and no one could help me.....I am able to load a movie from my pc to my iPad with no problem and the movie is a mpeg-4video file....totally​ clueless...

    I kept having a similar problem - 3 out of the 10 videos I had on iTunes wouldn't sync. They were in the right format and I KNEW they worked on my iPod because I'd RECORDED them on my iPod. I finally figured out what to do! Go to the movies in your iTunes library. Click on one that does not sync. Click on "Advanced" at the top of iTunes and choose "Create iPod or iPhone version". Once that's finished, be sure you delete the old version so you don't keep getting the error (or have 2 copies of the same video) and sync. This should eliminate the problem. At least it did for me!

  • HT204053 I cannot log into iCloud using my Apple username and password.  I keep getting an error message that states "CANNOT SIGN UP - The Apple ID is valid but is not an iCloud account."  How do I fix this?

    I cannot log into iCloud using my Apple username and password.  I keep getting an error message that states "CANNOT SIGN UP - The Apple ID is valid but is not an iCloud account."  How do I fix this?

    You are getting this message because you are attempting to create an iCloud account on a PC.  You can only create iCloud account on an iOS device (iPhone, iPad or iPod Touch) running iOS 5 or higher, or on a Mac running OS X Lion (10.7.2) or higher.  After creating your account on one of these devices you will then be able to sign into the account on your PC.

  • When I try to open a pdf  I get a acrobat reader error, It states ( There was an error opening this

    When I try to open a pdf  I get a acrobat reader error, It states ( There was an error opening this document. Could not repair file.

    There is not modern program called Acrobat Reader. There is an Adobe Reader program, there is an Adobe Acrobat (Pro or Std) program. Which program are you using? Under which OS?
    Please repost your question with your answer to either the Adobe Reader forum: http://forums.adobe.com/community/adobe_reader_forums  or  or the Acrobat Installation forum: http://forums.adobe.com/community/acrobat/installation_and_update_installation

  • Pleasse help me with this error in SQL statement

    Please tell me the error in this query:
    the Error given is
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement
    given :
    Databse is MS Access
    In the databse :
    account - text
    number - text
    date - date/time
    vendor - text
    Connection connection = t.getConnection();
    /* t - some object containing a connection*/
    Statement stmt = connection.createStatement();
    stmt.executeUpdate("INSERT INTO Bills (account, number, date, vendor)
    VALUES ('vai', '23', 10/12/2006, 'jaadya')");

    I would imagine the problem is with the date. Different DBs have different date formats. To avoid that problem, use a PreparedStatement.
    java.sql.Date date = ...;
    PreparedStatement ps = con.prepareStatement("INSERT INTO Bills (account, number, date, vendor) VALUES (?, ?, ?, ?)");
    ps.setString(1, "vai");
    ps.setString(2, "23);
    ps.setDate(3, date);
    ps.setString(4, "jaadya");
    ps.executeUpdate();This saves you from having to deal with vendors' various date formats, keeps you from having to escape special characters in strings, and prevents SQL injection.

  • Loading a js file gives this error: "missing ; before statement .. Line 1"

    After "Clearing Recent History" Cache
    The Error console shows:
    Error: missing ; before statement
    Source File: http://www.dmv-rom.ca/res2/res/js/modaldbox.js
    Line: 1, Column: 14
    Source Code:
    Date: Mon, 22 Aug 2011 20:05:41 GMT
    and points to the A in Aug
    The file content:
    * Modal Dialog Box
    * copyright 8th July 2006 by Stephen Chapman
    * http://javascript.about.com/
    * permission to use this Javascript on your web page is granted
    * provided that all of the code in this script (including these
    * comments) is used without any alteration
    function pageWidth() {return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;}function pageHeight() {return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;}function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;}function posTop() {return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;}function $mdbox(x){return document.getElementById(x);}function scrollFix(){var obol=$mdbox('ol');obol.style.top=posTop()+'px';obol.style.left=posLeft()+'px'}function sizeFix(){var obol=$mdbox('ol');obol.style.height=pageHeight()+'px';obol.style.width=pageWidth()+'px';}function kp(e){ky=e?e.which:event.keyCode;if(ky==88||ky==120)hm();return false}function inf(h){tag=document.getElementsByTagName('select');for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h;tag=document.getElementsByTagName('iframe');for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h;tag=document.getElementsByTagName('object');for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h;}function sm(obl, wd, ht){var h='hidden';var b='block';var p='px';var obol=$mdbox('ol'); var obbxd = $mdbox('mbd');obbxd.innerHTML = $mdbox(obl).innerHTML;obol.style.height=pageHeight()+p;obol.style.width=pageWidth()+p;obol.style.top=posTop()+p;obol.style.left=posLeft()+p;obol.style.display=b;var tp=posTop()+((pageHeight()-ht)/2)-12;var lt=posLeft()+((pageWidth()-wd)/2)-12;var obbx=$mdbox('mbox');obbx.style.top=(tp<0?0:tp)+p;obbx.style.left=(lt<0?0:lt)+p;obbx.style.width=wd+p;obbx.style.height=ht+p;inf(h);obbx.style.display=b;return false;}function hm(){var v='visible';var n='none';$mdbox('ol').style.display=n;$mdbox('mbox').style.display=n;inf(v);document.onkeypress=''}function initmb(){var ab='absolute';var n='none';var obody=document.getElementsByTagName('body')[0];var frag=document.createDocumentFragment();var obol=document.createElement('div');obol.setAttribute('id','ol');obol.style.display=n;obol.style.position=ab;obol.style.top=0;obol.style.left=0;obol.style.zIndex=998;obol.style.width='100%';frag.appendChild(obol);var obbx=document.createElement('div');obbx.setAttribute('id','mbox');obbx.style.display=n;obbx.style.position=ab;obbx.style.zIndex=999;var obl=document.createElement('span');obbx.appendChild(obl);var obbxd=document.createElement('div');obbxd.setAttribute('id','mbd');obl.appendChild(obbxd);frag.insertBefore(obbx,obol.nextSibling);obody.insertBefore(frag,obody.firstChild);
    window.onscroll = scrollFix; window.onresize = sizeFix;}
    window.onload = initmb;
    So I am confused as Line 1 is a comment
    This same load error may occur on any of several javascript files that are loaded.
    Happens in FF 3.1.18 and 6.0

    Corrected file header
    * Modal Dialog Box
    * copyright 8th July 2006 by Stephen Chapman
    * http://javascript.about.com/
    * permission to use this Javascript on your web page is granted
    * provided that all of the code in this script (including these
    * comments) is used without any alteration
    **/

  • When I plug in my hdmi lightening connector I get an error message that states the firmware has to download and the hardware cannot be used until the download is complete. How do I fix this problem?

    When I plug my hdmi lightening converter into my iphone5 I get an error message that states " downloading accessory firmware. Your accessory will not function until download completes.  How can I fix this?

    Don't know what changed today but it downloaded and installed on the shuffle. So far so good.

  • TS1550 My time capsule will not back up. There is a time machine error message that states "The backup disk image "/volumes/Backup/Jane's MacBook Pro.sparsebundle" is already in use. How do I correct this problem?

    My time machine will not back up. I get a Time Machine Error message that reads: "The backup disk image "/Volumes/Backup/(myname)'sMacBook Pro.sparsebundle" is already in use.
    I have not been able to back up for two weeks, I think this occurred after an update to the operating system, but I am unsure.
    How do I correct this problem?

    Have you tried restarting the computer? Also, see Time Machine Error from this pages sidebar under More Like This.

Maybe you are looking for

  • Is there a way to include a confirmation message when a form is successfully submitted?

    I have a form that uses both a regular button with javascript, and e-mail submit buttons (depending on which action on the form the user is trying to complete)... I'm trying to find a way to confirm to the user that their form has been submitted. Sin

  • What is the exact meaning of Dragging with(out) Drag Lock?

    I am new to Mac and I tried several ways to get known the difference. But what I see is that there is no difference between these two settings, anyone can explain to me? Thanks in advance.

  • Rate in Consignment PO

    Dear Experts, My client (senior) want at the time of release consignment Po rate should be display in Release screen (menas PO). How it is possible.. Neeru dimri

  • Conversion of numeric to character field

    Hi, I have an input field in which the user enters a number. This number has to be converted to character and then passed to the function module in my program. Please let me know which function module I can use to convert this number that the user en

  • Blocking a Price Condition

    Dear All, Can anybody suggest me if there can be a tcode to block or inactivate a pricing condition. Rgds, Indrajit