I am having problems getting my title and message to insert in my database, my database name is mt.mdb
and the table in the database is Tbl_Cinfo_main, and the fields are as follows , cinfomainID, title, description.
i have looked at the example file todatabase.asp and tried to make it work but it doesnt. it does not insert in the database.
i have my code below, can anyone help me. thanx.
<form name="frm_update_hp" id="frm_update_hp" method="POST" action="aboutmt_update.asp?action=save">
<span class="style3">About Us / Update</span> <br /><br />
Title
<%
dim conn
dim connstr
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../database/mt.mdb")
conn.Open connstr
dim content
if request("action")="save" then
TitleField = Request.Form("title")
MessageField = Request.Form("Editor1")
sql="select title,description from Tbl_Cinfo_main"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,3
rs.addnew
rs("title") = TitleField
rs("description") = MessageField
rs.update
response.write "<font size=5 color=darkred>Message added</font>"
response.write "<br>"
rs.close
set rs = nothing
else
MySQL="select top 1 * from Tbl_Cinfo_main order by cinfomainID DESC"
set rs2=conn.execute(MySQL)
if not rs2.eof then
TitleField = rs2("title")
MessageField = rs2("description")
rs2.close
set rs2=nothing
end if
end if
%>
<input name="TitleField" type="text" id="TitleField" value="<%= TitleField %>" size="60">
<br /><br />
About Mail Tech
<%
Dim editor
Set editor = New CuteEditor
editor.ID = "Editor1"
editor.Text = MessageField
editor.FilesPath = "../editor/CuteEditor_Files"
editor.Width = 700
editor.Draw()
' Request.Form(ID) access from other page
%>
<br />
<input name="author" type="hidden" id="author" value="<%= Session("MM_Username") %>" />
<input type="submit" name="Submit" value="Submit" />
<input type="hidden" name="MM_insert" value="frm_update_hp">
</form>