Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: recNo?

 
Allan Smith
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone!

I've been assigned the B&S assignment. So far I've managed to extract the field names and field lengths for the "Schema description section". But I'm having problems with the Data section; mainly when it comes to the record numbers. I'm probably missing the point here, or I am thinking way too much on relational databases.

Let's say I want to fetch a certain record, the interface DBAccess suggest I should provide a recNo as parameter and return a String[]. But how do I find the recNo? What is it? Something I have to create by myself?

Any help is appreciated!

Thanks in advance!
 
Ian Houston
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The record no. is implicit. Remember each record has certain byte length. So each such length is counted as a record. The first record is counted as No. 0, the second one 1, and etc.
 
Thomas Paul Bigbee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This stumped me as well, my assigment doesn't even have record numbers in the database (or any primary key), yet it requires you to fetch by record number, to implement this I just fetched record 1,2,3..., to start with, I then had the problem of how to get the record number from the JTable when they didn't exist, I took care of this problem by creating an array with one more element than the number of fields, when reading records (thru the search sceen) from the database, I appeneded the record number on the end (logical pk), that way if you want to delete or update a record, you can position yourself in the correct place inside the file by using the selected rows record number.

Hope this helps, Tom
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Java NC,

Welcome to JavaRanch and this forum.

We don't have many rules here, but one we do have is the Official policy on registered names. Could you please take the time to read this policy to see what we require as a displayed name? You can change your displayed name here.

Thanks,

Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic