Examples: ReadOnly property

This example contains an action that, depending on user input, displays and toggles the ReadOnly property.

Uselsx "*LSXODBC"
%INCLUDE "lsconst.lss"

Sub Postopen(Source As Notesuidocument)
  Set con = New ODBCConnection
  Set qry = New ODBCQuery
  Set result = New ODBCResultSet
  Set qry.Connection = con
  Set result.Query = qry
  con.ConnectTo("ATDB")
  qry.SQL = "SELECT * FROM STUDENTS ORDER BY LASTNAME"
  result.Execute
  ...
End Sub

Sub Click(Source As Button)
  If result.ReadOnly Then
    If Messagebox("Do you want to allow updates?", _
    MB_YESNO, "Updates disallowed (ReadOnly)") = IDYES Then
      result.ReadOnly = False
    End If
  Else
    If Messagebox("Do you want to disallow updates?", _
    MB_YESNO, "Updates allowed") = IDYES Then
      result.ReadOnly = True
    End If
  End If
End Sub