Where is the syntax error in my Insert statement?

It says that there is a syntax error in my insert statement, pointing to the .ExecuteNonQuery() at the end:
'Defining the activity ID from the datatable
Dim ActivityID As Integer = DataTableActivities.Rows(0).Item(0)
'Defining the calories from the datatable
Dim calories As Decimal = (DataTableActivities.Rows(0).Item(3)) * (DurationNum.Value / 60)
'Insert statement to add new training events
Dim SqlQueryActivityInsert As String = "INSERT INTO tblTraining (RunnerID, ActivityID, Full_Name, Time, Calories_Burnt, Date) VALUES (@RunnerID, @ActivityID, @Full_Name, @Time, @Calories, @Date)"
Dim SqlCommandActivity As New OleDbCommand
With SqlCommandActivity
.CommandText = SqlQueryActivityInsert
.Parameters.AddWithValue("@RunnerID", LoginForm.UserIDlbl.Text)
.Parameters.AddWithValue("@ActivityID", ActivityID)
.Parameters.AddWithValue("@Full_Name", LoginForm.Full_Namelbl.Text)
.Parameters.AddWithValue("@Time", DurationNum.Value)
.Parameters.AddWithValue("@Calories", calories)
.Parameters.AddWithValue("@Date", WeekPicker.Value)
.Connection = conn
.ExecuteNonQuery()

Viorel is right.  The 'Date' field is probably throwing it off.  Date is a reserved word. 
https://www.drupal.org/node/141051
Putting square brackets [] around the field name should get it working for you.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

Similar Messages

  • Where's the syntax error exist?

    Hi,Everyone
    The following statement exists an error:
    DELETE ITAB_YMIT00100 WHERE SOBKZ  IN (' ','K').
    Error Message:
    Comma without preceding colon(after DELETE?)
    About the above error, I do not know why?
    So I have to change the statement and pass debug.
    DELETE ITAB_YMIT00100 WHERE SOBKZ = ' ' OR SOBKZ = 'K'.
    Could anyone help me?

    hi,
    check whether ur internal table is with or with out heder line.  if it is with out header line then ur syntax is wrong.
    n try like this
    DELETE TABLE <itab> WITH TABLE KEY <k1> = <f 1> ... <k n> = <f n>.
    ex:DELETE ITAB_YMIT00100 FROM [WORKAREA] WITH KEY SOBKZ IN (' ','K').
    when it is with header line then,
    ex:DELETE ITAB_YMIT00100 WITH KEY SOBKZ IN (' ','K').
    IF HELPFUL REWARD SOME POINTS.
    WITH REGARDS,
    suresh aluri.

  • Requirement to check the syntax error of Customize SAP Objects in existing landscape.

    Hi All,
    I have two requirements which are a s follows :
    1 )    Check the syntax error of customize SAP Objects in existing landscape except using the Tools which are already given by SAP( Example : Code           Inspector , Extended Syntax Check etc.). I have to create a program to fulfill this requirement.
    2 )    In case of SAP Upgrade is it possible to know the syntax error in advance that the existing source code will not work in the upgrade version?
      Please help me out to solve my issues. Thanks in advance.

    Dear Abhishek,
    For the code inspector, the syntax check and the extended syntax check, you can define a set of objects to be teste thru SCI:
    Go to SCI
    In the block 'Object Set', you can create a set. For ths, you have to give it a name, select with the icon left of the textbox if this is a global (for all users) or a local set and click the create Icon.
    in the next field, you can define which objects ... are part of the object set.
    When using SCII to execute the code inspector, you can specify this set instead of a transport(s) or programming objects.
    To run only the syntax check and or the extend syntax check, you can specify a check variant in SCI (third screen block) which contains only those tests or you can in SCII uncheck all tests except those 2.
    Regards,
    Hans

  • HT5569 where is the information on how to insert a SIM-card?

    Where is the information on how to insert a SIM-card in an iPad Mini?

    http://support.apple.com/kb/ht5163
    http://support.verizonwireless.com/support/devices/knowledge_base.html/54813
     Cheers, Tom

  • I am having an installation failure issue with my itunes 11 software.  File is corrupted and i don't know what to do.  I've un-install and re-installed the software three times and continue to get the same error message.  It states that "This copy of ITun

    I am having an installation failure issue with my itunes 11 software.  File is corrupted and i don't know what to do.  I've un-install and re-installed the software three times and continue to get the same error message.  It states that "This copy of ITunes is corrupted or is not installed correctly.  Please reinstall Itunes"
    iMac, iOS 6

    HI,
    If your old version of iTunes is still working - then I sugest you stick with that.
    iTunes 11 is a lousy update - It will not retain your playlists, you can't find and delete duplicates... and a whole arry of oyher issues. (have a look around this forum to see how many issues IT11 gives people)
    Just a friendly advise and warning :-)

  • Can anyone spot the syntax error?

    I've been looking at this for about a day now and can't see the error, which is:
    Insert Failed: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
      public String addSaleList(SaleList sL) {
        try {
          //Gets the connection to customer database.
          Class.forName(Driver);
          Connection myCon = DriverManager.getConnection(Url);
          System.out.println(sL.saleListID + " " + sL.saleID + " " + sL.product
                             + " " + sL.number);
          String sqlQry = "INSERT INTO salelist(saleID, product, number)" +
              "VALUES(?,?,?)";
          PreparedStatement myStmt = myCon.prepareStatement(sqlQry);
          myStmt.setInt(1, sL.saleID);
          myStmt.setString(2, sL.product);
          myStmt.setInt(3, sL.number);
          myStmt.executeUpdate();
          return "Sale confirmed";
        catch (Exception e) {
          System.out.println("Insert Failed: " + e);
          return ("Insert Failed: " + e);
      public class SaleList {
        public int saleListID;
        public int saleID;
        public String  product;
        public int  number;
        public SaleList(int saleListID, int saleID, String product, int number) {
          this.saleListID = saleListID;
          this.saleID = saleID;
          this.product = product;
          this.number = number;
      SaleList saleL = new SaleList(0,10,"b",2);
      lblStatus.setText(sM.addSaleList(saleL));

    Hey this is the stack trace:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execut(JdbcOdbcPreparedStatement.java:214)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdateJdbcOdbcPreparedStatement.java:136)
         at myproject.SaleModel.addSaleList0 120 a 1
    (SaleModel.java:69)
         at myproject.SalesGUI.actionPerformed(SalesGUI.java:395)
         at java.awt.Button.processActionEvent(Button.java:382)
         at java.awt.Button.processEvent(Button.java:350)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

  • In sqlplus after a bad compile where does the show errors data exist?

    I am creating an automated deploy of code for project releases. In sqlplus I use the whenever command for sql errors but it doesn't catch bad compiles. When the process runs it runs as a dba user having the stored procs fully qualified causing the compile error not show in the user_errors but in all_errors. While experimenting I saw that another user could get a new record put into all_errors but my session when in sqlplus I still see the error from my compile from SHOW ERRORS. My question is where is the data from the show errors in my session stored and is it available for me to query so I can check for compile errors within sqlplus?
    Hope that was clear .
    Thanks,
    Ken

    In sqlplus ...You are in the wrong forum. This is for Oracle Forms.

  • Where are the WKG error codes

    I have searched all documents provided and I can't find documentation about the WKG error codes. Can anybody help?

    Java rarely produces an error log. It only does so when it has an internal error. You application freeze might be due to many different reasons. Do you know if the application works well for others?

  • Syntax error in For Loop statement

    Hello
    Normally my FOR staements have not been a problem as only access one table. I the example below I am accessing three table and therefore I get a Syntax error.
    I only wish to select the "Product" recored but need the other table to enable the select the right results.
    FOR product_rec IN (SELECT * from PRODUCT, PRODUCT_GROUP,PROD_PROD_GROUP
    where PRODUCT_GROUP.PRODUCT_GROUP_KEY = PROD_PROD_GROUP.PRODUCT_GROUP_KEY
    and PROD_PROD_GROUP.PRODUCT_KEY = PRODUCT.PRODUCT_KEY
    and product.supplier_key = company_no
    and PROD_PROD_GROUP.MULTI_WEB_DIS = 1
    order by PROD_PROD_GROUP.MULTI_WEB_SEQ)
    Can anyone let the correct syntx for this statement.
    Thanks
    Pete

    Like Dom said:
    FOR product_rec IN (SELECT PRODUCT.* from PRODUCT, PRODUCT_GROUP,PROD_PROD_GROUP
    where PRODUCT_GROUP.PRODUCT_GROUP_KEY = PROD_PROD_GROUP.PRODUCT_GROUP_KEY
    and PROD_PROD_GROUP.PRODUCT_KEY = PRODUCT.PRODUCT_KEY
    and product.supplier_key = company_no
    and PROD_PROD_GROUP.MULTI_WEB_DIS = 1
    order by PROD_PROD_GROUP.MULTI_WEB_SEQ) Or what he meant by "nice to have", use aliases:
    select p.*
    from
      product p,
      product_group pg,
      prod_prod_group ppg
    where
      pg.product_group_key = ppg.product_group_key
      and ppg.product_key = p.product_key
      and p.supplier_key = company_no
      and ppg.multi_web_dis = 1
    order by
      ppg.multi_web_seqAlso, note that company_no is not aliased in the above query. If this is a column, it should be aliased as well (either with the full table name or the alias if you switch to using them). If it is a PL/SQL variable, it is fine as is.
    Edited by: cmartin2 on Feb 2, 2011 1:56 PM

  • From where we can get error log of delivering state

    Hi Experts,
      I have processed large file and itseems the message got picked up successfully from sender side and got stucked in deleivering state. Can anyone suggest from where can we get error log that why the message is in delivering state.
    I have checked in channel and MM log but nat able to find.
    Thanks,
    Swetha

    Hi,
    You can check in engine status - backlog data in adapter engine in component monitoring.
    Please check below link:
    [http://help.sap.com/saphelp_nwpi71/helpdata/en/12/5dd23aaad7b3408dde3c1577fda5b3/content.htm]
    Regards,
    Beena.

  • Error Running SQL Insert Statement with & in it

    Eclipse: 3.5 Galileo on Window Vista
    OEPE: 11gR1 11.1.14
    I get "invalid character" error when running this query in Eclipse:
    INSERT INTO RECIPE (recipeId, name1, name2, recipeCategoryId) VALUES (2, 'Chunky Chicken Egg Rolls', 'No take&ndash;out joint can compare!', 1);
    I've tried multiple ways trying to escape the & character, but nothing worked. What is the right way of executing SLQ via OEPE plugin that have special characters in them.
    FYI, the following worked fine in Oracle 10g iSQL*Plus:
    SET DEFINE ~;
    INSERT INTO RECIPE (recipeId, name1, name2, recipeCategoryId) VALUES (2, 'Chunky Chicken Egg Rolls', 'No take&ndash;out joint can compare!', 1);
    Thanks,
    Dmitri.

    Very interesting case. I tried your insert stmt and got the same error. I finally got it to work by removing the ";" in the end. It looks like the jdbc driver choked up while there is ";" in the middle of the pl/sql statement and ";" in the end. If you remove ";" in the "No take&ndash;out joint can compare!" string and leave the ";" in the end, it also works!
    I don't quite understand why Oracle JDBC dirver behaves like that. I'll investigate it more and we may need to do some preprocessing on the pl/sql statement before sending it to the driver. At the mean time, just remove the ";" in the end if your string literal contains ";".
    Please let me know whether this workaround works for you. Thanks!
    Shenxue

  • Can anyone spot the syntax error of db delete?

    Hi
    I'm trying to get a database delete statement to work for a relations table - it just has studentId and courseId as foreign keys which make up a joint primary key.
    The line is
    db.update("delete from enrollments2 where (studentsid = '" + getStudentId() + "," + " coursesid = " +  getCourseId() + "')");The error is
    ERROR: invalid input syntax for integer: "78, coursesid = 75"Somehow I am putting non integer into an integer... I can't seem to spot the mistake though. Any help would be appreciated.

    The correct syntax I should mention was
    db.update("delete from enrollments2 where (studentsid = '" + getStudentId() + "'and coursesid = '" +  getCourseId() + "')");I'll leave that in for the time being and try to come back to it tonight... its on my todo list.
    Thanks for the snippet by the way, it always saves a lot of time when someone provides a useful snippet towards a solution. I hadn't heard of prepared statements until now too, interesting.
    Message was edited by:
    occams_razor
    -->> missed a 2 out there as enrollments2 is my test case

  • Can someone quickly spot the syntax error in this basic XML query?

    I'm very new to SQL/XML and I'm using this query in the basic HR schema provided by Oracle in the 10g Express Edition Database.
    I'm getting the "ORA-00907: missing right parenthesis" message when I run the following query, but the parenthesis all seem to match up:
    SELECT
    XMLELEMENT ("EMPLOYEES",
    XMLAGG(XMLELEMENT ("DEPARTMENTS",
    XMLELEMENT ("Department", department_name),
    (SELECT
    XMLELEMENT ("EMPLOYEE",
    XMLAGG(XMLELEMENT ("Empno", employee_id),
    XMLELEMENT ("Job", job_id),
    XMLELEMENT ("FirstName", first_name),
    XMLELEMENT ("LastName", last_name),
    XMLELEMENT ("Email", email),
    XMLELEMENT ("Phone", phone_number)))
    AS result
    FROM employees
    WHERE employees.department_id = departments.department_id)))
    AS result
    FROM departments)

    You do have the correct number of parenthesis, just the last one is in the wrong spot. Here is the corrected version. I moved the trailing ) to before "AS result"
    SELECT
    XMLELEMENT ("EMPLOYEES",
      XMLAGG(
        XMLELEMENT ("DEPARTMENTS",
          XMLELEMENT ("Department", department_name),
          (SELECT
             XMLELEMENT ("EMPLOYEE",
               XMLAGG(
                 XMLELEMENT ("Empno", employee_id),
                 XMLELEMENT ("Job", job_id),
                 XMLELEMENT ("FirstName", first_name),
                 XMLELEMENT ("LastName", last_name),
                 XMLELEMENT ("Email", email),
                 XMLELEMENT ("Phone", phone_number)
             ) AS result
             FROM employees
            WHERE employees.department_id = departments.department_id
    AS result
    FROM departmentsI don't have those tables installed but when I made a few tweaks and tried to run the above it encountered an error in regards to the inner XMLAGG. I tweaked your exampled and ended up with this. Feel free to change if not what you intended to produce.
    SELECT
    XMLELEMENT ("EMPLOYEES",
      XMLAGG(
        XMLELEMENT ("DEPARTMENTS",
          XMLELEMENT ("Department", department_name),
          (SELECT
             XMLAGG (
               XMLELEMENT("EMPLOYEE",
                 XMLFOREST (employee_id AS "Empno",
                            job_id AS "Job",
                            first_name AS "FirstName",
                            last_name AS "LastName",
                            email AS "Email",
                            phone_number AS "Phone"
             FROM employees
            WHERE employees.department_id = departments.department_id
    AS result
    FROM departments

  • Where are the bluetooth errors described?

    Hi,
    I can't find a listing that describes the meaning of the various
    Bluetooth errors I get when trying to connect my PDA-base app to a test
    server on my PC
    Some of the error codes are 12615 and 12579
    There are no errors in this range in the error code list in LabVIEW
    Anyone have any idea where to look?
    Senior Software Development Engineer
    Certified LabVIEW Architect and LabVIEW Champion

    Hello,
    You are correct that the error codes in this range are not documented/specified in LabVIEW.
    Can you give us more information on when and where (in which Bluetooth VIs) you get these errors?
    Thanks and best regards,
    Shakhina P.
    Applications Engineer
    National Instruments

  • Where are the unchecked errors?

    I get the warning
    GenericTree.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.Busy coding a generic tree class and was wondering where I did something incorrect. Here's the code so far...
    class TreeNode<T extends Comparable>
         TreeNode<T> leftNode;
         T data;
         TreeNode<T> rightNode;
         // contructor initialises data and makes this a leaf node
         public TreeNode(T nodeData)
              data = nodeData;
              leftNode = rightNode = null;
         // locate insertion point & insert node; ignore duplicate values
         public void insert(T insertValue)
              if(data.compareTo(insertValue) < 0)
                   if(leftNode == null)
                        leftNode = new TreeNode<T>(insertValue);
                   else // continue traversing left subtree
                        leftNode.insert(insertValue);
              else if(data.compareTo(insertValue) > 0)
                   if(rightNode == null)
                        rightNode = new TreeNode<T>(insertValue);
                   else // continue traversing right subtree
                        rightNode.insert(insertValue);
    public class GenericTree<T extends Comparable>
         private TreeNode<T> root;
         // contructor initializes root of a Tree object to null
         public GenericTree()
              root = null;
         public void insertNode(T insertValue)
              if(root == null)
                   root = new TreeNode<T>(insertValue); // create new node
              else
                   root.insert(insertValue); // calls insert method
    }Thanks!

    class TreeNode<T extends Comparable>You used a raw type here. Try this instead:class TreeNode<T extends Comparable<T>>

Maybe you are looking for

  • Has anyone experienced a problem with the adjustment brush since last update (for Mac) last week?

    Following an update to Lightroom on my Mac Pro work station last Friday: when I apply my adjustment brush to an area in an image, a faint box encompassing a much larger area than the size of my brush appears (extends well beyond the area I've identif

  • Template problem with a scroll

    Hi, This is Niranjan Reddy. I am using the ADF Ritch client with JDeveloper 11g Premier 1. I created a template with a panelstrech layout(position:absolute;width:100%;height:100%). My requirment is to increase the height of the layout when the compon

  • Ipad crashes after fresh install

    I bought a used ipad version A1459 (so ipad 3 32G with wifi and cellular). I set it up as new but the apps (all of them) continually closed after just a few seconds (even settings) When on the home screen it would jump to the multitasking screen and

  • User exit / BADI in MSC1N and MSC2N

    Hi all, I would like to make some automatic changes to MCH1-LWEDT in the course of batch posting (MSC1N and MSC2N). I found the definition BATCH_MASTER and some user exits, but none of them looks if I could make changes to the recorded batch data. Do

  • Usability of Iphone - Why is it different?

    Hi, As an Iphone user, can you please explain what is so special about Iphone that sets it apart from other Touchscreen devices. I would like to hear from a user perspective/point of view. I am writing a paper on touchscreens, and your insights/feedb