Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Need Help Editing A Record

magamanmagaman Posts: 14Member
I'm using Borland Turbo Pascal 7.0 and I would like to know how to search in a record, find the specific name like 'Jack Robinson' if the user types in that name, then behind the scenes i could transfer new data to that person's record file, then save the record with the new information. Any help will not be regretted and I'll be very happy to get it.:) thanks

Comments

  • zibadianzibadian Posts: 6,349Member
    : I'm using Borland Turbo Pascal 7.0 and I would like to know how to search in a record, find the specific name like 'Jack Robinson' if the user types in that name, then behind the scenes i could transfer new data to that person's record file, then save the record with the new information. Any help will not be regretted and I'll be very happy to get it.:) thanks
    :
    :
    The precise code depends on how the database is set up. In most cases the code looks somthing like this:
    [code]
    Navigate to first record
    while not EndOfDataBase do
    begin
    if IsRecordSearched then
    Break;
    GotoNextRecord;
    end;
    if IsRecordSearched then
    ReturnSearchResults
    else
    RecordNotFound
    [/code]
    In case of an array you can also substitute the while-do loop with a for-do loop.
    The IsRecordSearched can be a simple comparison of a field with a search-value, ie:
    [code]
    if Record.Name = SearchName then
    [/code]
    or can be a complex fuzzy-logic comparison function, which can also cope with typos in the searchvalue.

    In case of a (un)typed file, you can use Seek() to navigate to the correct record and then write to overwrite that 1 record. A text file must be partially copied and the altered record written instead of the existing one.
Sign In or Register to comment.