Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 27th, 2012, 02:12 PM
Registered User
 
Join Date: Nov 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Insert Statement

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!

Last edited by wonderwoman; November 27th, 2012 at 02:21 PM.. Reason: Some mistakes corrected
 
Old November 28th, 2012, 01:52 PM
Registered User
 
Join Date: Nov 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default No problem - it works

Ooops...

I switched the computer on today - and brought the message board up and it suddenly works!!

Apologies for wasting anyone's time...

Relief...

Wonderwoman :)
 
Old December 5th, 2012, 12:21 AM
Registered User
 
Join Date: Nov 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

IT WORKED FOR ME TOO AND I WOULD ALSO SAY THAT ITS JUST GREAT STUFF TO LOOK UP FOR





Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert statement? Phil Critchley ASP.NET 4 General Discussion 1 May 5th, 2011 02:53 AM
Insert statement Banishah ASP.NET 3.5 Basics 1 August 9th, 2009 01:51 PM
Autonumber and insert into statement. rupen Access VBA 1 July 27th, 2007 02:23 PM
Insert Statement Iashia06 Access 0 April 7th, 2006 12:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.