By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,480 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,480 IT Pros & Developers. It's quick & easy.

Microsoft VBScript compilation error '800a0401'

P: 4
Can anyone help...?

I keep getting this error message and am now getting angry. I have checked my syntax hundreds of times and can not seem to find anything wrong with it....I think I need a fresh pair of eyes..please can someone help me.

I have copied the code below:
================================================== =

Expected end of statement

/admin/news_update_pro.asp, line 22

conn.Open "SET DateFormat dmy;update NewsItem set create_date='"&c_date&"', release_date='"&r_date&"', short_headline='"&s_headline&"', headline='"&headline&"', abstract='"&abstract&"', full_text='"&f_text&"' where id='"&id&"'",objConn,3,3
---------------------------------------------------------------------------------------------------------------------------------------------------^
Dec 10 '07 #1
Share this Question
Share on Google+
8 Replies


Expert 100+
P: 164
i can't seem to spot it in the code sample provided. Can you cut/paste the entire script?
Dec 11 '07 #2

P: 4
Here is the entire code copied below:
Thanks
Expand|Select|Wrap|Line Numbers
  1. <!--#include file="connection.asp"-->
  2.  
  3. <%     
  4.     id=request.Form("id") 
  5.  
  6.     create=request.Form("c_date")
  7.     create_date=CDate(create) 
  8.  
  9.     release=request.form("r_date")
  10.     release_date=CDate(release) 
  11.  
  12.     short_headline=request.Form("s_headline") 
  13.     headline=request.Form("headline") 
  14.     abstract=request.Form("abstract") 
  15.     full_text=request.Form("f_text") 
  16.  
  17.     set conn=Server.CreateObject("ADODB.Recordset")   
  18.  
  19.     ''conn.Open "update NewsItem set create_date='"&c_date&"', release_date='"&r_date&"', short_headline='"&s_headline&"', headline='"&headline&"', abstract='"&abstract&"', full_text='"&f_text&"' where id='"&id&"'",objConn,3,3
  20.  
  21.  
  22.    conn.Open "SET DateFormat dmy;update NewsItem set create_date='"&c_date&"', release_date='"&r_date&"', short_headline='"&s_headline&"', headline='"&headline&"', abstract='"&abstract&"', full_text='"&f_text&"' where id='"&id&"'",objConn,3,3
  23.  
  24. //   conn.Close()
  25.    set conn=nothing
  26.  
  27.     Response.Redirect ("news_index.asp")
  28. %>
Dec 11 '07 #3

jhardman
Expert 2.5K+
P: 3,405
For troubleshooting purposes, dump this "SET dateFormat..." string into a variable, then print it out. When you call the conn.open line you can easily do this:
Expand|Select|Wrap|Line Numbers
  1. dim query
  2. query = "SET DateFormat dmy" 'etc
  3.  
  4. response.write query 'this line can be commented out after everything works
  5.  
  6. conn.open query, objConn, 3,3
Let me know if this helps.

Jared
Dec 12 '07 #4

Expert 100+
P: 164
Is your variable id supposed to be a string? You have it wrapped in apostrophes, so I am curious.
Dec 13 '07 #5

Expert 100+
P: 164
That error is normally indicative of a misspelled, or non-existent field in your SQL query. Check to make sure that all the fields in your SQL statement are all correctly spelled and actually a part of the table your updating.
Dec 14 '07 #6

P: 4
Is your variable id supposed to be a string? You have it wrapped in apostrophes, so I am curious.

Yes it is meant to be a string...It is the id number of the News item am entering into the database.
Dec 17 '07 #7

P: 4
For troubleshooting purposes, dump this "SET dateFormat..." string into a variable, then print it out. When you call the conn.open line you can easily do this:
Expand|Select|Wrap|Line Numbers
  1. dim query
  2. query = "SET DateFormat dmy" 'etc
  3.  
  4. response.write query 'this line can be commented out after everything works
  5.  
  6. conn.open query, objConn, 3,3
Let me know if this helps.

Jared

Hi Jared,

I tried that but it has not worked.
The problem seems to point to "headline" I am unsure why it stimbles here but not on the others.
Dec 17 '07 #8

jhardman
Expert 2.5K+
P: 3,405
Hi Jared,

I tried that but it has not worked.
The problem seems to point to "headline" I am unsure why it stimbles here but not on the others.
show the query as it is written out in the response.write line
Dec 17 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.