473,406 Members | 2,710 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,406 software developers and data experts.

Syntax Error in SQL Update Statement

Can some one help me with finding the error is this statement?

strSQL_Update = "UPDATE tblWJS_SuperInput SET JobNumber= '"&
strJobNumber &"', " _
& "WeekendingDate = '"& strWeekEndingDate &"', "_
& "CurrentHours = '"& strCurrentHours &"', "_
& "CurrentHoursTaping = '"& strCurrentHoursTaping &"', "_
& "ReportRequired_01 = '"& strReportRequired_01 &"', " _
& "ReportRequired_02 = '"& strReportRequired_02 &"', " _
& "ReportRequired_03 = '"& strReportRequired_03 &"', " _
& "ReportRequired_04 = '"& strReportRequired_04 &"', " _
& "ReportRequired_05 = '"& strReportRequired_05 &"', " _
& "ReportRequired_06 = '"& strReportRequired_06 &"', " _
& "ReportRequired_07 = '"& strReportRequired_07 &"', " _

& "WHERE JobNumber ="&strJobNumber&" AND WeekEndingDate ="&
strWeekEndingDate &""

strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=\
\CALSJ1\xxxx.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open strConnect
Set objRecordSet = conn.Execute(strSQL_Update)

Feb 26 '07 #1
3 4114
Maximus wrote:
Can some one help me with finding the error is this statement?

strSQL_Update = "UPDATE tblWJS_SuperInput SET JobNumber= '"&
strJobNumber &"', " _
& "WeekendingDate = '"& strWeekEndingDate &"', "_
& "CurrentHours = '"& strCurrentHours &"', "_
& "CurrentHoursTaping = '"& strCurrentHoursTaping &"', "_
& "ReportRequired_01 = '"& strReportRequired_01 &"', " _
& "ReportRequired_02 = '"& strReportRequired_02 &"', " _
& "ReportRequired_03 = '"& strReportRequired_03 &"', " _
& "ReportRequired_04 = '"& strReportRequired_04 &"', " _
& "ReportRequired_05 = '"& strReportRequired_05 &"', " _
& "ReportRequired_06 = '"& strReportRequired_06 &"', " _
& "ReportRequired_07 = '"& strReportRequired_07 &"', " _
This is less than optimal database design. For one thing, what if you
need an eighth report? You will have to revise the table as well as all
queries that reference it: a maintenance nightmare. A better design
would involve a separate table with three columns: JobNumber,
ReportRequiredOrdinal, and ReportRequired
& "WHERE JobNumber ="&strJobNumber&" AND WeekEndingDate ="&
strWeekEndingDate &""

strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=\
\CALSJ1\xxxx.mdb"
Nothing to do with your problem but:
http://www.aspfaq.com/show.asp?id=2126
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open strConnect
Set objRecordSet = conn.Execute(strSQL_Update)
Is WeekendingDate a date/time field? If so, date literals need to be
delimited with octathorps (#), not quotes ('). Quotes are used for
strings, not dates in JetSQL.

Further points to consider:
Your use of dynamic sql is leaving you vulnerable to hackers using sql
injection:
http://mvp.unixwiz.net/techtips/sql-injection.html
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23

See here for a better, more secure way to execute your queries by using
parameter markers:
http://groups-beta.google.com/group/...e36562fee7804e

Personally, I prefer using stored procedures, or saved parameter queries
as
they are known in Access:

Access:
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

http://groups.google.com/groups?hl=e...tngp13.phx.gbl

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 26 '07 #2
Maximus wrote:
Can some one help me with finding the error is this statement?
Please do not multipost Maximus. This is definitely a database-related
question
so .asp.db was the perfect group in which to post it. Posting it here as
well did not increase your chances of getting an answer (most of us
subscribe to both groups). On the contrary, if somebody had taken his
time
to answer it here, only to find that it was already resolved in the
other
group, that person may have been annoyed enough to ignore any future
posts
from you, thereby decreasing your chances of getting help in the future.

There are times when you will not be sure which group is most
appropriate,
and you will want to post a question to both groups. In that situation,
you
should use the cross-posting technique, rather than posting the same
message
multiple times. To crosspost, put a semicolon-delimited* list of the
newsgroups to which you wish to post in the To: header of your post and
post
it once. It, and any replies to it, will appear in all the newsgroups in
your list. So, if I reply in .asp.db, my reply will also appear here in
..asp.general.

* ... or whatever delimiter is recognized by your news client

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 26 '07 #3
Bob Barrows [MVP] wrote:
Maximus wrote:
>Can some one help me with finding the error is this statement?
Please do not multipost Maximus.
Oops - disregard this. my mistake.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Robert Mark Bram | last post by:
Hi All! I have the following two methods in an asp/jscript page - my problem is that without the update statement there is no error, but with the update statement I get the following error: ...
7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
5
by: S.Patten | last post by:
Hi, I have a problem with updating a datetime column, When I try to change the Column from VB I get "Incorrect syntax near '942'" returned from '942' is the unique key column value ...
4
by: Bob Stearns | last post by:
The statement: merge into nullid.animals_et_in t1 using is3.animals t2 on t1.sire_assoc=t2.assoc and t1.sire_prefix=t2.prefix and t1.sire_regnum=t2.regnum when matched then update set...
4
by: deko | last post by:
I'm trying to update the address record of an existing record in my mdb with values from another existing record in the same table. In pseudo code it might look like this: UPDATE tblAddress SET...
1
by: amitbadgi | last post by:
HI i am getting the foll error while conv an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Syntax error in UPDATE statement. Source Error: Line...
6
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the ...
8
by: Stephen Plotnick | last post by:
I have three forms and update one table in an Access DB with sucess in one form. In the other two forms I'm trying to do an update to a different table in the Access DB. The error I'm getting...
1
by: ajos | last post by:
hi evrybdy, the problem is:- i had this running before in jsp but when i changed the jsp page using struts tags there occoured a problem... when i enter values in the 2 text boxes and click enter...
3
by: phobia1 | last post by:
Hi once again. We have just changed our ISP and things that worked fine now do not, Obviously its in the differences of MYSQL and PHP versions. Have fixed most of the problems but this UPDATE...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.