• 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

my sql code for my last inquiry....

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

state.executeUpdate("INSERT INTO Candidates VALUES("+candidateID+","+can.getSalutation()+","+can.getLastName()+","+can.getFirstName()+","+isResume+","+isClients+","+isNamecard+","+isExeclist+","+isProspect+","+isHot+","+can. getEthnicity()+","+can.getNationality()+","+can.getSex()+","+can.getBirthday()+","+can.getBirthmonth()+","+can.getBirthyear()+","+can.getMaritalStatus()+","+can.getEducation()+","+ can.getLanguage()+","+can.getJobTitle1()+","+can.getCompany1()+","+can.getWorkAddress1()+","+can.getWorkAddress2()+","+can.getWorkAddress3()+","+can.getWorkPhone()+","+can.getWorkE mail()+","+can.getJobTitle2()+","+can.getCompany2()+","+can.getLocation2()+","+can.getJobTitle3()+","+can.getCompany3()+","+can.getLocation3()+","+can.getHomePhone()+","+can.getMob ilePager()+","+can.getHomeEmail()+","+can.getHomeAddress1()+","+can.getHomeAddress2()+","+can.getHomeAddress3()+","+isRemarks+",'websiteform',"+can.getJobIndustry()+",'dataentrydat e','updateddate','resumelocation','formattedresumelocation','coverLetterFileLocation','interviewNotesFileLocation','otherFileLocation1','otherFileLocation2','otherFileLocation3','o therFileLocation4',"+can.getImageFileLocation()+",88,'generalNotes')");
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should use the query in this fashion :
state.executeUpdate("INSERT INTO Candidates VALUES('"+candidateID+"','"+can.getSalutation()+"','"+can.getLastName()+"','"+can.getFirstName()+"'.............
Whenever the value is a string, use the single quotes outside the double quotes, if value is a number, you do not need to use single quotes.
 
Bradley Wong
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks shilpa!!! it worked. my statement was so long, it was easy to overlook that. thanks again
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Crikey!
Do me a favour: when you get a chance, check out PrepardStatements. A lot easier to read, therefore easier to debug.
Would look something like this:

Advantages are that it is easier to read and you don't have to worry about single quotes at all, they are handled for you.
A few more lines of code, but you'll be thankful after you have to debug stuff like that a few times.
(I also like the ++i bit since it allows you to insert and delete attributes during development without worrying about hard coded values)

Dave.
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic