Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9137857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:10:52+00:00 2026-06-17T09:10:52+00:00

I want to add a new record to access database,, but the SQL query

  • 0

I want to add a new record to access database,, but the SQL query is not applying it,, here is my Code in which i am adding data!!

    public void actionPerformed(ActionEvent e) {
    JButton b=(JButton)e.getSource();
    if(b==c.t.addR){
        String aa=Integer.toString(55);
        String t=c.t.titlefield.getText();
        String d=c.t.datefield.getText();
        String p=c.t.progressfield.getText();
        String pr=c.t.priorityfield.getText();
        String s="Open";
        System.out.println(t+"\t"+d+"\t"+p+"\t"+pr+"\t"+s); //error is here
        try {
            c.b.st.executeQuery("INSERT into Records (TaskID,Title,Deadline,Progress,Priority,Status) VALUES("+aa+"','"+t+"','"+d+"','"+p+"','"+pr+"','"+s+")");
        } catch (SQLException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    }

Here is the error i am getting

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]
Syntax error (missing operator) in query expression
’55’,’a’,’1′,’1′,’high’,’Open’. at
sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at
sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at
sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source) at
sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source) at
sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source) at
Listener.actionPerformed(Listener.java:27) at
javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at
javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at
javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at
javax.swing.DefaultButtonModel.setPressed(Unknown Source) at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source) at
javax.swing.JComponent.processMouseEvent(Unknown Source) at
java.awt.Component.processEvent(Unknown Source) at
java.awt.Container.processEvent(Unknown Source) at
java.awt.Component.dispatchEventImpl(Unknown Source) at
java.awt.Container.dispatchEventImpl(Unknown Source) at
java.awt.Component.dispatchEvent(Unknown Source) at
java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at
java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at
java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at
java.awt.Container.dispatchEventImpl(Unknown Source) at
java.awt.Window.dispatchEventImpl(Unknown Source) at
java.awt.Component.dispatchEvent(Unknown Source) at
java.awt.EventQueue.dispatchEventImpl(Unknown Source) at
java.awt.EventQueue.access$400(Unknown Source) at
java.awt.EventQueue$2.run(Unknown Source) at
java.awt.EventQueue$2.run(Unknown Source) at
java.security.AccessController.doPrivileged(Native Method) at
java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source) at
java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source) at java.awt.EventQueue$3.run(Unknown Source) at
java.awt.EventQueue$3.run(Unknown Source) at
java.security.AccessController.doPrivileged(Native Method) at
java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at
java.awt.EventDispatchThread.run(Unknown Source)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:10:53+00:00Added an answer on June 17, 2026 at 9:10 am

    The error has to be happening on this line:

    c.b.st.executeQuery("INSERT into Records (TaskID,Title,Deadline,Progress,Priority,Status) VALUES("+aa+"','"+t+"','"+d+"','"+p+"','"+pr+"','"+s+")");
    

    And looking at it, it will be because you don’t have an openning and closing quote around your parameters? Try:

    c.b.st.executeQuery("INSERT into Records (TaskID,Title,Deadline,Progress,Priority,Status) VALUES('"+aa+"','"+t+"','"+d+"','"+p+"','"+pr+"','"+s+"')");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I add a new record I want SQL Server to automatically add a
I've following Grid to display data, now when I want to add new record
i want to add the records into the MS access database from the form
I am connecting a clients Access database to a website but need to add
I want to add a record into access. The column name is Names: Now
I just created a new gem (using bundler) and want to add Active Record
I want add new Feed item on entity persist and update. I write this
I want to add new obj of JSON like: 128: { Msg: [{ me:
I am working with an NSOperationQueue and I want to add new NSOperations to
I want to test Add new item activity in my application. When user fills

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.