I was unable to get that to work. I think I misunderstood where to place the code. Would you mind to point out the proper place for me?
Here is the entire code for the form page:
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsProject 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = CLng(Request.QueryString("ID"))
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("projects.mdb")
'Create an ADO recordset object
Set rsProject = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT projects.* FROM projects WHERE ID=" & lngRecordNo
'Open the recordset with the SQL query
rsProject.Open strSQL, adoCon
thisContent = rsProject("Notes")
thisContent = replace(thisContent,"'","\'")
%>
<form name="F1" id="F1" method="post" action="update_entry2.asp">
<div id="form">
<table width="980">
<tr>
<td width="96">
<b>
Project Title:
</b>
</td><td width="894">
<input type="text" name="ProjectTitle" style="width:99%; height:16px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;" value="<% = rsProject("ProjectTitle") %>"> </td>
</tr></table>
<table width="980">
<tr>
<td width="176">
<b>
Targeted Completion Date:
</b>
</td><td width="690">
<input type="text" name="TargetDate" style="width:10%; height:16px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"value="<% = rsProject("TargetDate") %>"> </td>
<td width="1">
<b>
Priority:
</td><td width="9">
<input type="text" name="Priority" style="width:90%; height:16px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"value="<% = rsProject("Priority") %>"> </td></tr></table>
<table>
<tr>
<td>
<b>
Details:</td> </tr></table>
<!-- #INCLUDE file="includes/FCKeditor/fckeditor.asp" -->
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "includes/FCKeditor/"
oFCKeditor.Create "notes"
%>
<script language="javascript" type="text/javascript">
<!--
window.onload = function()
{
document.F1.notes.value= ' <%=thisContent%> ' ;
}
-->
</script>
</td></tr></table><table width="980"><tr><td width="20">
<b>
Submitted By:
</td><td width="110">
<input type="text" name="SubmittedBy"style="width:90%; height:16px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;" value="<% = rsProject("SubmittedBy") %>">
</td>
<td width="10">
<b>
On:
</td><td valign="center" width="100">
<input type="text" name="PostedDate" style="width:70%; height:16px; font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;" value="<% = rsProject("PostedDate") %>">
</td>
<td width="130"> Project Complete <input name="completed" type="checkbox" id="completed" value="true" checked>
</td>
<td width="20">
<b>
Completeded By:
</td><td width="115">
<input type="text" name="CompletedBy"style="width:90%; height:16px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"> </td>
<td width="10">
<b>
On:
</td><td valign="center" width="70">
<input type="text" name="CompletedDate" style="width:95%; height:16px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;">
</td>
<td valign="bottom" align="right" width="128">
<input type="hidden" name="ID" value="<% = rsProject("ID") %>">
<br> <input type="submit" name="Submit" value="Submit">
</form>
</td>
</tr></table>
</div>
</form>
<!-- End form code -->
</body>
</html>
<%
'Reset server objects
rsProject.Close
Set rsProject = Nothing
Set adoCon = Nothing
%>
|
And here is the complete page where the data is processed.
[code]
<% 'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsUpdateEntry 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query to query the database
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = CLng(Request.Form("ID"))
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("projects.mdb")
'Create an ADO recordset object
Set rsUpdateEntry = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT projects.* FROM projects WHERE ID=" & lngRecordNo
'Set the cursor type we are using so we can navigate through the recordset
rsUpdateEntry.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsUpdateEntry.LockType = 3
'Open the recordset with the SQL query
rsUpdateEntry.Open strSQL, adoCon
'Update the record in the recordset
rsUpdateEntry.Fields("ProjectTitle") = Request.Form("ProjectTitle")
rsUpdateEntry.Fields("TargetDate") = Request.Form("TargetDate")
rsUpdateEntry.Fields("SubmittedBy") = Request.Form("SubmittedBy")
rsUpdateEntry.Fields("PostedDate") = Request.Form("PostedDate")
rsUpdateEntry.Fields("Priority") = Request.Form("Priority")
rsUpdateEntry.Fields("Notes") = Request.Form("Notes")
rsUpdateEntry.Fields("Completed") = Request.Form("Completed")
rsUpdateEntry.Fields("CompletedBy") = Request.Form("CompletedBy")
rsUpdateEntry.Fields("CompletedDate") = Request.Form("CompletedDate")
'Write the updated recordset to the database
rsUpdateEntry.Update
'Reset server objects
rsUpdateEntry.Close
Set rsUpdate