• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2488
  • Last Modified:

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

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
daydreamer6565
Asked:
daydreamer6565
  • 3
1 Solution
 
for_yanCommented:
I think here you have openeing single quote but no clsoing quote:
'"+ delvryDtTxtfld.getText()+",

it shoudl be

'"+ delvryDtTxtfld.getText()+"',
0
 
for_yanCommented:
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
 
daydreamer6565Author Commented:
Yes you were right ..i corrected it and now the record is inserted sucessfully..
Thanks :D
0
 
for_yanCommented:
Good, it worked for you!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now