Link to home
Start Free TrialLog in
Avatar of daydreamer6565
daydreamer6565

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

Avatar of daydreamer6565
daydreamer6565

ASKER

Yes you were right ..i corrected it and now the record is inserted sucessfully..
Thanks :D
Good, it worked for you!