Solved

Error:VALUES clause must contain at least one element. Empty elements are not allowed.

Posted on 2012-03-26
4
2,317 Views
Last Modified: 2012-08-13
I am creating an application for tracking orders of cloth store..
I am getting error-
java.sql.BatchUpdateException: VALUES clause must contain at least one element. Empty elements are not allowed.
I took 'ORDER_INDEX' as auto increment..i have read that there is no need to provide any value for a field which is auto increment so im not providing any value for 'ORDER_INDEX'.. what could b the issue ...pls see the attached codes..
table-creation.txt
insert-code.txt
0
Comment
Question by:daydreamer6565
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 37769810
I think here you have openeing single quote but no clsoing quote:
'"+ delvryDtTxtfld.getText()+",

it shoudl be

'"+ delvryDtTxtfld.getText()+"',
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37769822
try to replace with this statemnent:
stmt.addBatch("INSERT INTO ordertbl(ONAME,DESCRIPTION,CUSTOMER,PHONE,ORDERDATE,DELIVERYDATE,ADVANCE,BAL)VALUES('"+ordrnamTxtfld.getText()+"','"+descTxtfld.getText()+"','"+custTxtFld.getText()+"','"+custPhnTxtfld.getText()+"','"+ordrDateTxtfld.getText()+"','"+ delvryDtTxtfld.getText()+"',"+Float.parseFloat(advancTxtfld.getText())+","+Float.parseFloat(balanceTxtfld.getText())+")");

Open in new window

0
 

Author Comment

by:daydreamer6565
ID: 37769843
Yes you were right ..i corrected it and now the record is inserted sucessfully..
Thanks :D
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37769845
Good, it worked for you!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question