File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checking for already existing data

 
Patrick Mugabe
Ranch Hand
Posts: 132
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I have a simple form which takes in Student Details such as name, surname, address, etc and saves the data to a database. The studentID is automatically generated.
I would want to do a check to see whether the typed in name and surname already exists because there is a possibility of entering the same details twice since studentID is an autoNumber.
How can I check before updating.
Please assist.
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You just have to check/search your database for the firstname & lastname combination before making the entry.
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
But you shouldn't only check for first and last name. Cause it is possibility that two people have the same name. Better check for something
unique like the Student ID. Or take additional fields to check for uniqueness.
 
Nagendra Prasad
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is referred to as the logical key for that table.
This is generally a set (or single) column in a table which also needs to be unique apart for the primary key. (Which is most cases is a sequence generated integer).
Define a logical key for your student table and you would know what to search on!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic