ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 24th, 2003, 11:27 PM
inferno81 inferno81 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Melbourne, Australia
Posts: 2 inferno81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ASP/SQL UPDATE syntax error

The script I'm doing is simple enough - updating information in an MS Access database. The error message I'm getting is:
Microsoft JET Database Engine error '80040e14'
Syntax error in UPDATE statement.
[path]/edit_news_script.asp, line 53


The code is:
Code:
51 Conn.Execute("UPDATE news SET title = '" + title_string + "' WHERE news_id = " + file);
52 Conn.Execute("UPDATE news SET body = '" + content_string + "' WHERE news_id = " + file);
53 Conn.Execute("UPDATE news SET update = '" + update_string + "' WHERE news_id = " + file);


Lines 51 and 52 are executing without trouble - 53 is the trouble line. I thought it might be something in the 'update_string' variable mucking things up, but I took it out, inserted normal text, and wound up with the same result. The database fields are all named correctly.

I don't know if this is just so blazingly obvious that I'm overlooking it or what, so any help would be greatly appreciated.

Cheers.

Reply With Quote
  #2  
Old July 25th, 2003, 04:12 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,719 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 50 m 18 sec
Reputation Power: 688
You're using javascript on the server it looks like.

In vbs I'd build the sql string into a variable before executing it, and then insert a response.write sqlvar before executing on the connection. This will show you the string in your browser (and show everyone else so don't do this on a live site!)

Reply With Quote
  #3  
Old July 25th, 2003, 11:04 AM
WineIsGood's Avatar
WineIsGood WineIsGood is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: New York
Posts: 49 WineIsGood User rank is Private First Class (20 - 50 Reputation Level)WineIsGood User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 7 m 51 sec
Reputation Power: 6
You're using "Update" as a field name, but it's a reserved word. Rename the field or wrap it in []. May I also suggest printing the VB variable "Update" and even the whole SQL Update command string instead of executing it, just to see if there are quotes or strange characters floating around in there... that's typically the problem.
-Dave

Reply With Quote
  #4  
Old July 25th, 2003, 08:55 PM
inferno81 inferno81 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Melbourne, Australia
Posts: 2 inferno81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by WineIsGood
[B]You're using "Update" as a field name, but it's a reserved word. Rename the field or wrap it in [].
Yeah, thanks. I realised this soon after I'd posted here, and started beating my head on the wall - figuratively. It's all working spiffy now.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > ASP/SQL UPDATE syntax error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway