QMRead()

QMRead()

Top  Previous  Next

 

The QMRead() function reads a record without locking. It is analogous to the QMBasic READ statement.

 

The function arguments are:

 

FileNois the file number returned by a previous QMOpen() call.

 

Idis the id of the record to be read.

 

Erris an integer variable to receive status information. This argument is not present in all variants of the QMClient API.

 

 

The QMRead() function requests the server to return the record with key Id from the file opened as FileNo.

 

If successful, the function returns the record as a dynamic array string and the Err variable is set to SV_OK.

 

If the record cannot be found, the function returns a null string and the Err variable is set to SV_ELSE. The QMStatus() function can be used to retrieve the error number.

 

Conditions that would normally cause a QMBasic program to abort or to take the ON ERROR clause of a READ statement return a null string and the Err variable is set to SV_ON_ERROR. The QMStatus() function can be used to retrieve the error number.

 

The example program fragment below opens the CLIENTS file, reads the record identified by ClientNo, and then closes the file. A real program should test the Err status from the read to determine if the action was successful.

 

 

hmtoggle_plus1C

 

hmtoggle_plus1VB.Net

 

hmtoggle_plus1QMBasic Class Module

 

hmtoggle_plus1Java

 

hmtoggle_plus1Python