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
Solved

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

Posted on 2012-03-26
4
2,190 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
  • 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
V.simple question about Android packages and libraries 1 29
varialbe initialization 11 37
MySqlDump not dumping triggers 1 43
Desingning Refactoring existing code 2 26
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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 the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

860 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