This is the code I have for saving pages to a DB. I modified the todatabase.asp and added a couple of fields to the test.mdb. This ain't the tightest code but it works.
<html>
<head>
<title>CuteEditor : Add the editor content to the database</title>
<link href="example.css" type="text/css" rel="stylesheet">
</head>
<body>
<form name="theForm" action="todatabase.asp" method="post" ID="Form1">
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0 ID="Table1">
<TR><TD class=ContentBg vAlign=top height=480><BR><TABLE cellSpacing=0 cellPadding=4 width="100%" align=center border=0 ID="Table2">
<TR><TD id=ContentPane width=* vAlign=top bgcolor=white>
<%
dim conn
dim connstr
dim filename
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("webdb.mdb")
conn.Open connstr
dim content
if Request.Form("del") <> "" Then
sdelrec = "true"
delrec()
end if
if Request.Form("add") <> "" then
%>
<input type=hidden value="add" name=addnew>
<%
end if
if Request.Form("newfile") <> "" then
addnew()
end if
if Request.Form("filename3") <> "0" and Request.Form("filename2") = "0" and Request.Form("newfile") = "" and Request.Form("add") = "" and sdelrec = "" then
updatefile()
end if
%>
<table width="100%" cellspacing="1" cellpadding="5" border="0"><tr valign="top"><td nowrap>Select Page:</td><td>
<SELECT NAME="filename2" size=1 onchange=theForm.submit()>
<OPTION VALUE=0>Select A Page
<%
loadsel()
sub loadsel()
MySQL="select id, Filename from webdb"
set rs2=conn.execute(MySQL)
do until rs2.eof%>
<OPTION VALUE=<%=rs2("id")%>><%=rs2("Filename")%>
<%rs2.movenext
Loop
rs2.close
set rs2=nothing
end sub
%>
</SELECT> OR <input type=submit name=add value="Add Page"></td></tr>
<%
if request.form("filename2") <> "" and Request.Form("add") = "" and Request.Form("del") = "" then
dim filename2
dim fileid
if request.form("filename2") = "0" then
filename1 = request.form("filename3")
else
filename1 = request.form("filename2")
end if
if filename1 = "" then
MySQL="select max(id) as id from webdb"
set rs2=conn.execute(MySQL)
id = rs2("id")
rs2.close
MySQL="select webdb.id, Filename,titlefield,messagefield,defaultpg from webdb where id="& id
else
MySQL="select webdb.id, Filename,titlefield,messagefield,defaultpg from webdb where id="& filename1
end if
set rs2=conn.execute(MySQL)
filename2 = rs2("filename")
fileid = rs2("id")
titlefield = rs2("titlefield")
messagefield = rs2("messagefield")
if rs2("defaultpg") = "Y" then
ckstat = "Checked"
end if
%>
<td nowrap>Page Being Edited:</td><td>
<input type=text name=edfile value=<%=filename2%> size="20"><input type=hidden name=filename4 value="<%=filename2%>"><input type=hidden name=filename3 value=<%=fileid%>> <input type=submit name=del value="Delete Page"></td></tr>
<%
else
%>
<td nowrap>New Page Name:</td><td>
<input type=text name=newfile value="" size="20"> <input type=submit name=del value="Delete Page"></td></tr>
<%
end if
%>
<tr valign="top"><td Width="70"class="SubHead">Title:</td><td width="*" valign="bottom">
<input name="TitleField" type="text" maxlength="100" size="40" id="TitleField" value="<%= TitleField %>"class="NormalTextBox" style="width:600px;">
</td></tr><tr valign="top"><td Width="100"class="SubHead" nowrap>Page Content:</td><td><input type=checkbox name=default value="Y" <%=ckstat%>> Set as The Default Page?</td></tr><tr><td width="*" colspan=2>
<%
Dim editor
Set editor = New CuteEditor
editor.ID = "Editor1"
editor.Text = MessageField
editor.FilesPath = "CuteEditor_Files"
editor.ImageGalleryPath = "/Uploads"
editor.MaxImageSize = 50
editor.AutoConfigure = "EnableAll"
editor.Width = "100%"
editor.Height = 350
editor.Draw()
Request.Form("Editor1_HTMLContent")
%>
</td></tr></table></div><br><br></td></tr></table></td></tr></table>
</form>
</body>
<%
sub addnew()
TitleField = Request.Form("TitleField")
MessageField = Request.Form("Editor1_HTMLContent")
fname = Request.Form("newfile")
if default = "Y" then
sql = "update webdb set defaultpg = ''"
conn.execute(sql)
end if
sql="select Filename, TitleField,MessageField,defaultpg from webdb"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,3
rs.addnew
rs("Filename") = fname
rs("TitleField") = TitleField
rs("MessageField") = MessageField
rs("defaultpg") = Request.Form("default")
rs.update
response.write "<font size=5 color=darkred>Page Has Been Added!</font>"
rs.close
set rs = nothing
end sub
sub updatefile()
filename = request.form("edfile")
title = Request.Form("TitleField")
mess = Request.Form("Editor1_HTMLContent")
default = Request.Form("default")
filename4 = request.form("edfile")
if default = "Y" then
sql = "update webdb set defaultpg = ''"
conn.execute(sql)
end if
sql = "update webdb set filename='" & filename4 &"' ,titlefield='" & title & "',messagefield='" & mess &"', defaultpg='"& default &"' where id =" & request.form("filename3")
response.write "<font size=5 color=darkred>Page Has Been Updated!</font>"
conn.execute(sql)
end sub
sub delrec()
sql = "Delete * from webdb where id =" & request.form("filename3")
response.write "<font size=5 color=darkred>Page Has Been Delete!</font>"
conn.execute(sql)
end sub
%>
</html>
Jimmy brown
Kingsport City schools
technical services