Программирование в IIS

Пример 1.10

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'OpenChair 'Opens an existing record for a chair and 'populates the object with the values ' 'in: Chair ID to open 'out: returns true on success and false otherwise '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Public Function OpenChair(ID As String) As Boolean On Error GoTo Sub_Error_Handler Const ERROR_MESSAGE_INFO = "OpenChair"


Dim sSQL As String Dim rs As ADODB.Recordset

'build the insert statement sSQL = COMMAND_PREFIX & ID & COMMAND_SUFFIX

'get Recordset Set rs = GetADORecordSet(sSQL)

'make certain we got a valid Recordset If rs Is Nothing Then Err.Raise 1001, ERROR_MESSAGE_INFO, _ "Failure Opening Chair ID = " & ID End If

'make certain that we got a Recordset 'with at least 1 value If rs.EOF And rs.BOF Then Err.Raise 1001, ERROR_MESSAGE_INFO, _ "Failure - record for Chair does not exist. ID = " & ID End If


'set new ID to local setting m_sID = rs(CHAIR_ID)

'set new color to local setting color = rs(CHAIR_COLOR)

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub_Exit_Done: 'return success value

OpenChair = True

On Error Resume Next 'destroy objects Set rs = Nothing Exit Function

Sub_Error_Handler: ProcessErr "Failure Opening Chair ID = " & ID

End Function

Листинг 1.10. Function OpenChair

Закрыть окно

- Начало -  - Назад -  - Вперед -