473,321 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Expected end of statement

3
Hi,

I'm having a problem with an UPDATE statement. This works fine:

Expand|Select|Wrap|Line Numbers
  1. SQL = "UPDATE Tests SET Face='"&Face&"', Eyes='"&Eyes&"', Glasses ='"&Glasses&"', Beard ='"&Beard&"', Moustache='"&Moustache&"' WHERE ID = 1"
but if I add Hairstyle, Haircol, HairXcoord or HairYcoord, I get an error, e.g. this doesn't work:

Expand|Select|Wrap|Line Numbers
  1. SQL = "UPDATE Tests SET Face='"&Face&"', Hairstyle='"&Hairstyle&"', Beard ='"&Beard&"', Moustache='"&Moustache&"' WHERE ID = 1"
The error points to Hairstyle (or Haircol, or whichever one I put in), but I have checked that the field names are correct and that they have values in the Flash file I call the ASP from, so I have no idea what is going wrong. Any suggestions?

Thanks!
Sep 6 '08 #1
7 1253
DrBunchman
979 Expert 512MB
Hi JenMac,

You are certain that there are values being passed into the SQL string? Also, do any of the values you are passing in contain single quotes which, as SQL String delimiters, could cause an error?

Dr B
Sep 8 '08 #2
jhardman
3,406 Expert 2GB
Usually "Expected End of Statement" means you are missing or have an extra quote mark or you have some other really stupid syntax error. Don't feel ashamed, we've all done this and then felt stupid when we found it.

Jared
Sep 8 '08 #3
JenMac
3
Thanks for your replies.

I decided to change the names I gave the variables in the ASP file - I changed 'Haircol' to 'Col', 'Hairstyle' to 'Style', etc, and it works fine now. I had checked and re-checked the syntax - there were definitely no extra or missing ' and the the values are all numberical, so no ' in them either.

I really don't understand why ASP would have a problem with my variable names, it's not like 'Haircol' is a protected word! If anyone ever comes up with an idea about why it caused a problem, please let me know!

Thanks again for your help.

Jen
Sep 9 '08 #4
DrBunchman
979 Expert 512MB
Hi Jen,

That is very strange! I would probably still guess that you had some bug in there somewhere because I can't think of any reason why your original variable names wouldn't have worked.

At least it's working now!

Dr B
Sep 9 '08 #5
omerbutt
638 512MB
SQL = "UPDATE Tests SET Face='"&Face&"', Hairstyle='"&Hairstyle&"', Beard ='"&Beard&"', Moustache='"&Moustache&"' WHERE ID = 1"
hi firstly the above sql statement are you ,.......or will you be continiously comparing the ID with 1 if so then do write it between the single quotes for example
Expand|Select|Wrap|Line Numbers
  1. SQL = "UPDATE Tests SET Face='"&Face&"', Hairstyle='"&Hairstyle&"', Beard ='"&Beard&"', Moustache='"&Moustache&"' WHERE ID = '1' "
  2.  
if not then do try the following ,
if it is not going to be a hard coded string then it would be comming from else somewhere in that case type cast it into Clng() and then compare it for example i will assume that the ID is Comming from a prev page
Expand|Select|Wrap|Line Numbers
  1. lng_id=Clng(request("db_ID"))
  2. SQL = "UPDATE Tests SET Face='"&Face&"', Hairstyle='"&Hairstyle&"', Beard ='"&Beard&"', Moustache='"&Moustache&"' WHERE ID = "&lng_id
  3.  
hope that would solve the problem
regards,
omer
Sep 10 '08 #6
JenMac
3
Hi,

The ID is just a test at the moment, you are right - I will be changing this code once I have the database fully set up. At the moment, there is only one record, which has an ID of 1. Thanks for the help with the code for when I do get round to it, though!

Jen
Sep 10 '08 #7
omerbutt
638 512MB
Hi,

The ID is just a test at the moment, you are right - I will be changing this code once I have the database fully set up. At the moment, there is only one record, which has an ID of 1. Thanks for the help with the code for when I do get round to it, though!

Jen
yeah sure jen any time
regards,
Omer Aslam
Sep 11 '08 #8

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

Similar topics

1
by: Phil Powell | last post by:
Here is the function ArraySearch: '-------------------------------------------------------------------------------------- 'ArraySearch will return an integer value indicating the first...
7
by: Graham James Campbell CS2000 | last post by:
Having a nightmare problem with this and would appreciate any and all help. The situation is I want to move from a webform and format the user inputted text into some html I am storing in a...
3
by: Matt | last post by:
When the ASP statement end with a _ character, then the next line cannot have comment ' character. Is that correct? Since I encountered the following error: Microsoft VBScript compilation...
5
by: andy.herrera | last post by:
I'm getting this Error Message. Expected ';' Please Select One: <form name="form1"> <<------------ Error is here. <select name="selectTrans" onChange="If (this.value == 'checkout')...
2
by: Edward S | last post by:
I would appreciate if someone could correct my SQL statement which is displaying a message Expected : End of Statement this statment is attached to a button on the form StrSQL = "PARAMETERS !!...
3
by: NeilH | last post by:
Hello All I was wondering if someone could offer a rather inexperienced person some advice. Im trying to get my asp page to look at an access data I created the following query in access...
35
by: Marchel | last post by:
For a long time I was a gib fan of Borland C++ Builder with VCL framework and never gave a second look in Microsoft products since I've seen MFC. Anyway, recently Borland decided out of the blue to...
39
by: eruanion | last post by:
Hi, I've been working on this for a while now and I can't seem to find out what is wrong with my code. I have 2 files one c3common.js which only contains javascript functions for my main html page...
3
by: eBob.com | last post by:
I've done a lot of programming but very little OOP. Would someone be kind enough to explain to me why I get a "declaration expected" on this statement: anythingarray(0) = new anything(3) ...
1
by: nosaj070 | last post by:
Hi, I'm working on a project and it is my first time implementing VBA with Access. I know my SQL Statement is close, but it obviously isn't perfect, if any of you can see what the error is I'd really...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.