<html><head>
<%PageTitle="Create and delete"%>
<!-- #include virtual="/include/head.asp"-->
<a href="/include/code.asp?<%=Request.ServerVariables("url")%>" target=code><b>Show Code</b></a><br>
<div>This is a working page of a sample application. Please try submitting different data. See how errors are handled.</div>
<%on error resume next
'first let's create a group
Set Group=server.CreateObject("DB3NF.Item")
Group.Class="group"
Group("name")="temporary group"
if group.Validate then
Group.SetInfo
Response.Write "<h3>Group created with id = " & Group.ID & "</h3>"
else
Response.Write "can't create group - " & Group("name").ErrorMessage
'Response.End
end if
'Show all the groups in the database
set oDB=server.CreateObject("DB3NF.Database")
ShowGroups
'Delete group
Group.Delete
Response.Write "<hr><h3>temporary group deleted</h3>"
'Show list again
ShowGroups
sub ShowGroups()
dim group
set Groups=oDB.All("group")
Response.Write "<hr><h3>Groups (id-name):</h3>"
for each group in groups
Response.Write group.id & " - " & group("name") & "<br>"
next
end sub
%>
<%
if err then Response.Write "<p><b>Application error</b></p>"
%>
<!-- #include virtual="/include/footer.asp"-->