Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms 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 May 13th, 2004, 07:55 PM
Authorized User
 
Join Date: May 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jturlington
Default Execute problem, Incorrect syntax

I am getting the error

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 8: Incorrect syntax near 'm'.
/members/addart_process.asp, line 6

<%
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "dsn","sa","password"
mySQL = "INSERT INTO dbo.article (ArticleTitle,ArticleCont,ArticleDate,ArticleAutho r)"
mySQL = mySQL & " VALUES ('" & request.form("ArticleTitle") & "','" & request.form("ArticleCont") & "','" & request.form("ArticleDate") & "','" & request.form("ArticleAuthor") & "')"
oConn.execute (mySQL)
oConn.close
response.Redirect("../done.asp") %>

Any help would be much appreciated.

Thank you,
Jon Turlington
__________________
Thank you,
Jon Turlington
 
Old May 14th, 2004, 07:09 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Are you inserting a value that has single quotes in it? For example, does the Article Title data have a ' in it? I've seen that error occur from this. It may help to do a:

Response.Write("mySQL") and look at the sql at the screen, and post that.

If that is the problem, you have to do replace(request.form("ArticleTitle"), "'", "''"). SQL will interpret two '' as one '.

Brian
 
Old May 14th, 2004, 08:17 AM
Authorized User
 
Join Date: May 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jturlington
Default

For some reason the just started working again no clue.

Thank you,
Jon Turlington





Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorrect syntax near '.' meraj ADO.NET 6 February 27th, 2012 01:01 AM
Incorrect syntax near '!' sinapra Classic ASP Databases 8 August 25th, 2004 02:15 AM
Incorrect syntax near '`' Hez Classic ASP Databases 3 August 5th, 2004 08:13 AM
Incorrect syntax...... Adam H-W Classic ASP Databases 8 June 21st, 2004 11:14 AM
Incorrect SQL Syntax?! ckudrna Access VBA 1 June 5th, 2003 03:07 PM





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