Save the People
Public Sub Save()
Dim strSQL As String
Dim guid As CGuid
Dim bInsert As Boolean

   If ID = "" Then
      ' Generate the ID
   bInsert = True
      Set guid = New CGuid
      ID = guid.GetGuid
   Else
      bInsert = False
   End If

   If bInsert Then
      strSQL = "INSERT INTO tblPerson " & _
      "(ID, FirstName, LastName, XMLData) " & _
      "VALUES ('" & ID & "', '" & FirstName & _
      "', '" & LastName & "', '" & FormatXML() _
      & "')"
   Else
      ' Update
      strSQL = "UPDATE tblPerson " & _
         "SET FirstName = '" & FirstName & _
         "', " & "LastName = '" & LastName & _
         "', " & "XMLData = '" & FormatXML() & _
         "' WHERE ID = '" & ID & "'"
   End If

   mcn.Open
   mcn.Execute strSQL
   mcn.Close
   Set mcn = Nothing

End Sub

Listing 1 The Save method of the CPerson object saves an XML representation of the person's data at the time the person is saved. It uses the CGuid class to generate a unique identifier for the person the first time the person is saved.