• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem: SQL Exception

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sql Exception is thrown : java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] You cannot add or change a record because a related record is required in table 'BATCH'.

BATCH TABLE
------------
BATCHID TEXT (PRIMARY KEY)
STUDENT TABLE
-------------
FIRSTNAME TEXT
LASTNAME TEXT
YEARID TEXT
SECTION TEXT
ROLLNO TEXT (PRIMARY KEY)
BATCHID TEXT (PRIMARY KEY)
DEPTCODE TEXT (PRIMARY KEY)
ADDRESS TEXT
PHONENO TEXT
MOBILENO TEXT
EMAIL TEXT
GENDER TEXT
PASSWORD TEXT
ENROLLMENTNO TEXT
"INSERT INTO STUDENT ( FIRSTNAME , LASTNAME , YEARID , SECTION , ROLLNO , BATCHID , DEPTCODE , ADDRESS , PHONENO ,MOBILENO , EMAIL , GENDER , PASSWORD , ENROLLMENTNO ) VALUES ('"+firstName+"', '"+lastName+"', '"+yearID+"', '"+section+"', '"+rollNo+"', '"+batchID+"', '"+deptCode+"', '"+ address+"', '"+phoneNo+"', '"+mobileNo+"', '"+emailAddress+"', '"+gender+"', '"+password+"', '"+enrollmentNo+"')";
The value of the batch ID that i m passing in the above query in already present in the Batch Table
 
Simon John
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have solved the problem
 
catch it before it slithers away! Oh wait, it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic