Solved

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
parentbit challenge 3 52
strCopies  challenge 17 73
topping1 challenge 7 53
compre toata in where clue oracle 4 44
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now