Hi
I am in the process of creating a message board from an earlier website I built in asp using a database originally created in the '90s. I am using the same code. However when I change the name of the database to correspond to the new database on the asp page, I get the response:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/nameofwebsite/forum/new.asp, line 184
Browser Type:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; BTRS121216; GTB7.4; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2; .NET4.0C)
Page:
POST 184 bytes to /nameofwebsite/forum/new.ASP
POST Data:
frmName=Wonderwoman&
[email protected] o.uk&frmUrl=http%3A%2F%2F&frmFheadline=Computer+
Pr oblem&frmFcontents=This+is+the+problem%3A++&hname= hvalue&vOpa=&vfgroup=40&OK=Display
When I bring up the old website using an Microsoft Access 2000 formatted version it works perfectly on my localhost. However, when I paste the webpage called "new.asp" into my new site, and have imported the table from this database into my 2007 Access database it brings the above result. I have tried creating the table afresh in Microsoft Access 2007 using the 2000 format but this makes no difference to the error.
I have checked the permissions - they are ok. All my other insert statements work on my new website. But this particular page requires values to be automatically inserted into the database - e.g. the opening thread number - as I said, it works ok when using the old database.
I don't believe it is anything to do with the code...
But here is the complete code:
<%
' On Error Resume Next
If Request.Form("hname") = "" Then
' This part of the script enables a person
' to enter data in an HTML form.
%>
<body bgcolor="#FFFFCC" TEXT="#000000">
<% vOpa = Request.QueryString("vOpa") %>
<form METHOD="Post" ACTION="new.ASP">
<p>
<table border="0">
</p>
<tr>
<TD><h3><font face="Arial" color="#000000">TO POST A MESSAGE TO THE MESSAGE
BOARD</font></h3></TD></tr>
<table border="0">
<tr>
<td>
</td>
<td><font size="-1" color="#00009F">Example</font>
</td>
<td><font size="-1" color="#00009F">Entry</font>
</td>
</tr>
<tr>
<td>Last Name:
</td>
<td><font size="-1" color="#00009F">Smith/Jones</font>
</td>
<td><input NAME="frmName" TYPE="TEXT" SIZE="40">
</td>
</tr>
<tr>
<td>E-Mail:
</td>
<td><font size="-1" color="#00009F">
[email protected]</font>
</td>
<td><input NAME="frmEmail" TYPE="TEXT" SIZE="40">
</td>
</tr>
<tr>
<td>URL:
</td>
<td><font size="-1" color="#00009F">http://www.nameofwebsite.com</font>
</td>
<td><input NAME="frmUrl" TYPE="TEXT" Value="http://" SIZE="40">
</td>
</tr>
<tr>
<td>Subject:
</td>
<td><font size="-1" color="#00009F">Topic</font>
</td>
<td><input NAME="frmFheadline" TYPE="TEXT" SIZE="40">
</td>
</tr>
<tr>
<td valign="top">Contribution:
</td>
<td>
</td>
<td><textarea NAME="frmFcontents" ROWS="12" COLS="40" SIZE="32000" ALIGN="left"></textarea>
</td>
</tr>
<tr>
<td><input TYPE="HIDDEN" NAME="hname" VALUE="hvalue">
<input NAME="vOpa" TYPE="HIDDEN" VALUE="<%=vOpa%>">
<input NAME="vfgroup" TYPE="HIDDEN" VALUE="40">
</td>
<td><input NAME="OK" TYPE="SUBMIT" value="Display">
</td>
<td><input NAME="Reset" TYPE="RESET" value="Reset">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<hr>
<table border="0">
<tr> <td></td>
<td>
<!-- REM *** Place for advertising or comments** REM -->
</td>
</tr>
</table>
</body>
</html>
<% Else
' This part f the script shows the person
' the selection.%>
<html>
<head><title>Name of website - Confirmation</title></head>
<body bgcolor="#FFFFCC" TEXT="#00000000">
<table border="0">
<body bgcolor="#FFFFCC" TEXT="#00000000">
<% If Request.Form("frmName") = "" Then %>
<p><font color="#000000">You have not given your name.</font>
<p><font color="#000000"> You may like to try </font><a HREF="new.asp?vOpa=<%=vOpa%>">
again</a>.
</td></tr>
<% ElseIf Request.Form("frmEmail") = "" Then %><font color="#000000"> It is a
super name, but unfortunately not an EMail-ID</font>
<p>You have not selected an E-Mail Address.
<p>
You may like to try <a HREF="new.asp?vOpa=<%=vOpa%>">again</a>.
</td></tr>
<% Else %>
<p><font face="Arial" color="#000000">Thank you for your contribution</font>
<p>
<b><font face="Arial" color="#000000"><%= Request.Form("frmName") %></b></font>
<hr>
<br>
<%
vfheadline = Request.Form("frmFheadline")
vfheadline = Replace(vfheadline, "'", "''")
vName = Request.Form("frmName")
vName = Replace(vName, "'", "''")
vfcontents = Request.Form("frmFcontents")
vfcontents = Replace(vfcontents, "'", "''")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "magicbox"
qry = "INSERT INTO [forum] (fposition, flevel, fgroup, Opa, Name, fheadline, fcontents, email, url ) VALUES (1, 1, 40, "
qry = qry & Request.Form("vOpa") & ", '"
qry = qry & Server.HTMLEncode(vName) & "', '"
qry = qry & Server.HTMLEncode(vfheadline) & "', '"
qry = qry & Server.HTMLEncode(vfcontents) & "', '"
qry = qry & Request.Form("frmEmail") & "', '"
qry = qry & Request.Form("frmUrl") & "')"
Set RS = Conn.Execute(qry)
%>
<% End If %>
<% End If %>
<%
Conn.Close
Set Conn = nothing
%>
</td>
</tr>
<tr> <td><a HREF="http://p2p.wrox.com/contents.ASP"></td>
<td><a HREF="http://p2p.wrox.com/contents.ASP">Return to the Message Board Contents</a></td>
</tr>
</table>
</html>
I would be very grateful for a solution!