` Printed Icetips Article

Icetips Article



Par2: Testing for results after Fetch
1998-01-23 -- Jim Katz
 
The Methods, Access:FileName.Fetch or Access:FileName.TryFetch are actually 
functions, that is they do have return values that you can test for. They are declared 
with the proc attribute so you don't have to use them as functions.

 If you use the TryFetch method you can test for which error has been returned using 
the old ErrorCode()and Error() functions:
If Access:MyFile.TryFetch(My:key)
  Message('Errorcode is ' & ErrorCode() ! or
  If Error() = 'Record Not Found'
    Access:MyFile.ThrowMessage(FileErrorCode(),'Record Not Found')
  End
Else
 etc..
Be aware though, there are some known problems when using the Fetch or Tryfetch
methods with some file drivers. Check back through the Topspeed list, I think, it has to 
do with Get(File,key) on certain drivers, which is what fetch is doing.



Printed December 3, 2024, 11:15 am
This article has been viewed/printed 35211 times.