Solved

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

Posted on 2012-03-26
4
2,294 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
printf performancy 11 101
Is there a simpler dropbox system? 10 53
What is the use of Forwarding Class in java 1 52
How to fix  socket closed error 11 63
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

737 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