Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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 18th, 2007, 08:07 AM
Authorized User
 
Join Date: Apr 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp help for newbie syntax error

Hello,

I am a newbie in ASP, I am trying to list a specific record and update it from the db table. But I keep getting this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '='.
student_edit.asp, line 105
Thanks for your help.

Here is my code:

<%
function fixStr( theString )
    fixStr = replace( theString, "'", "''")
end function

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open strConnect
%>

<%
sqlString = "select * from jenny where ID =" & ID
Student name: <input type="text" name="name" value="<%=Student_name%>"><br />
Country: <input type="text" name="country" value="<%=country%>"><br />
Phone: <input type="text" name="phone" value="<%=phone%>"><br />
Email: <input type="text" name="email" value="<%=email%>"><br />

<%
sqlString = "update jenny set " &_
    "Student name ='" & fixStr( Student_name ) & "', " &_
    "Country ='" & fixStr( Country ) & "', " &_
    "Phone ='" & fixStr( Phone ) & "', " &_
    "Email ='" & fixStr( Email ) & "' where ID =" & ID

    dbCon.Execute sqlString
%>

http://www.asiafuns.com/asian_friends/
__________________
---------------------
There is NO stupid question.
 
Old May 18th, 2007, 08:18 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Syntactally speaking, your SQL code statement looks fine, however it is relying on variables for its values so it is possible that a ' is being passed into your sql statement which is causing it to fail.

Do a response.write sqlString and see what the literal value is. That should give you an idea as to where the problem is coming from.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old June 1st, 2007, 01:08 PM
Authorized User
 
Join Date: Apr 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks.

http://www.asiafuns.com/asian_friends/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error in FROM clause: asp jpindi ASP.NET 1.0 and 1.1 Basics 6 July 16th, 2008 12:30 AM
ASP.NEt syntax error crmpicco ASP.NET 2.0 Basics 5 December 7th, 2006 12:54 PM
Syntax error for chapter 15 AddUser.asp gymmic Classic ASP Databases 7 April 20th, 2004 02:00 AM





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