adoFldSetValue
Previous Topic  Next Topic 

Synopsis:

       adoFldSetValue(handle,ix/name,Value)

Arguments:

       handle        - The recordset handle.

         ix/name        - The field index number or field name

       pValue        - Pointer to the variable that will hold the returned field value


Description:   This function sets the value of the field specified by the field index number (ix) or the field name to the value specified by Value for the current record in the recordset specifed by handle.      The function will detect automatically whether a field index number or field name has been specified.        


This only updates the fields values in the current copy of the record.   In order to save the values to the underlying database table then it is necessary to call the adoRSetUpdate() function.   Also if you move from the record you are adding or editing before calling the Update method, ADO will automatically call Update to save the changes. You must call the adoRSetCancelUpd() function if you want to cancel any changes made to the current record.


Below is an example showing this function in use.   This example assumes that the underlying recordset has fields called 'date','time','telno','duration','rate' and 'cost':


        // Add a new record to the record set

        x=adoRSetAddNew(SetHandle);

        if(x < 0)

            stop;

        endif


        // Set the field values for the new record

        adoFldSetValue(SetHandle,"date","20090101");

        adoFldSetValue(SetHandle,"time","120000");

        adoFldSetValue(SetHandle,"telno","971414292929");

        adoFldSetValue(SetHandle,"duration",26);

        adoFldSetValue(SetHandle,"rate","0.08");

        adoFldSetValue(SetHandle,"cost","0.035");


        // Update the underlying record set

        adoRSetUpdate(SetHandle);



Returns:   Returns 0 upon success or a negative error code.   If ADOERR_COMERR is returned, then the underlying ADO error can be obtained by calling adoLastError()