473,763 Members | 6,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Syntax error in UPDATE statement- asp/jscript

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:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/polyprint/dataEntry.asp, line 158

I fail to understand why there is a syntax error - I am pretty sure all of
the parameters to the Open method are ok..

Any advice would be most welcome!

Rob
:)

function modifyNewslette r()
{
var _newsletter = getParameter ("edition");
var _language = getParameter ("language") ;

var sql = "SELECT * " +
"FROM newsletterText " +
"WHERE (((newsletterTe xt.pageName)='" + _newsletter + "') " +
"AND ((newsletterTex t.language)='" + _language + "')) " +
"order by newsletterText. paragraph asc";

var newsletterText = getRecordSetFor ModifyingRecord s (sql);

while (!newsletterTex t.EOF)
{
Response.Write (newsletterText ("text") + " --- " +
newsletterText ("style") + "<br>");

newsletterText ("text") = "changed... ";

// problem statement
newsletterText. Update;

Response.Write (newsletterText ("text") + " --- " +
newsletterText ("style") + "<br>");
newsletterText. MoveNext();
} // end while
// Gets a recordset for modifying records.
// Uses the adLockOptimisti c lock and accepts an sql statement.
function getRecordSetFor ModifyingRecord s (sql)
{
var rs = Server.CreateOb ject ("ADODB.Records et");
rs.Open (sql, // Source
polyprintConnec tion, // ActiveConnectio n
adOpenForwardOn ly, // CursorType
adLockOptimisti c); // LockType
return rs;
} // end getRecordSetFor ModifyingRecord s function
Jul 19 '05 #1
3 6228
Where's line 158? And what does Response.write( sql) show you for the SQL
query just before that line?

Ray at work

"Robert Mark Bram" <re********@rem ovethis.optusho me.com.au> wrote in message
news:3f******** **************@ news.optusnet.c om.au...
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:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement. /polyprint/dataEntry.asp, line 158

I fail to understand why there is a syntax error - I am pretty sure all of
the parameters to the Open method are ok..

Any advice would be most welcome!

Rob
:)

function modifyNewslette r()
{
var _newsletter = getParameter ("edition");
var _language = getParameter ("language") ;

var sql = "SELECT * " +
"FROM newsletterText " +
"WHERE (((newsletterTe xt.pageName)='" + _newsletter + "') " + "AND ((newsletterTex t.language)='" + _language + "')) " +
"order by newsletterText. paragraph asc";

var newsletterText = getRecordSetFor ModifyingRecord s (sql);

while (!newsletterTex t.EOF)
{
Response.Write (newsletterText ("text") + " --- " +
newsletterText ("style") + "<br>");

newsletterText ("text") = "changed... ";

// problem statement
newsletterText. Update;

Response.Write (newsletterText ("text") + " --- " +
newsletterText ("style") + "<br>");
newsletterText. MoveNext();
} // end while
// Gets a recordset for modifying records.
// Uses the adLockOptimisti c lock and accepts an sql statement.
function getRecordSetFor ModifyingRecord s (sql)
{
var rs = Server.CreateOb ject ("ADODB.Records et");
rs.Open (sql, // Source
polyprintConnec tion, // ActiveConnectio n
adOpenForwardOn ly, // CursorType
adLockOptimisti c); // LockType
return rs;
} // end getRecordSetFor ModifyingRecord s function

Jul 19 '05 #2
Try response.writin g your variable sql to the screen and see what the lines
says, try and post that as a query directly into access and see if it gives
you anything.

It could be something to do with the way you are breaking up the sql
statement (like missing a space accidently) so put it all in one line for
the moment might help and then when you are done, then you can break it up.

I don't know about JS with serverside stuff, but in vbscript you should put
something like

sql = "SELECT * "sql = sql +
sql = sql + "FROM newsletterText "sql = sql +
sql = sql + "WHERE (((newsletterTe xt.pageName)='" + _newsletter + "') "sql
= sql +
sql = sql + "AND ((newsletterTex t.language)='" + _language + "')) "sql =
sql +
sql = sql + "order by newsletterText. paragraph asc"

Not saying any of these things are the prob, but may help trouble shoot the
issues you are seeing.

Good luck

Stu

"Robert Mark Bram" <re********@rem ovethis.optusho me.com.au> wrote in message
news:3f******** **************@ news.optusnet.c om.au...
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:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement. /polyprint/dataEntry.asp, line 158

I fail to understand why there is a syntax error - I am pretty sure all of
the parameters to the Open method are ok..

Any advice would be most welcome!

Rob
:)

function modifyNewslette r()
{
var _newsletter = getParameter ("edition");
var _language = getParameter ("language") ;

var sql = "SELECT * " +
"FROM newsletterText " +
"WHERE (((newsletterTe xt.pageName)='" + _newsletter + "') " + "AND ((newsletterTex t.language)='" + _language + "')) " +
"order by newsletterText. paragraph asc";

var newsletterText = getRecordSetFor ModifyingRecord s (sql);

while (!newsletterTex t.EOF)
{
Response.Write (newsletterText ("text") + " --- " +
newsletterText ("style") + "<br>");

newsletterText ("text") = "changed... ";

// problem statement
newsletterText. Update;

Response.Write (newsletterText ("text") + " --- " +
newsletterText ("style") + "<br>");
newsletterText. MoveNext();
} // end while
// Gets a recordset for modifying records.
// Uses the adLockOptimisti c lock and accepts an sql statement.
function getRecordSetFor ModifyingRecord s (sql)
{
var rs = Server.CreateOb ject ("ADODB.Records et");
rs.Open (sql, // Source
polyprintConnec tion, // ActiveConnectio n
adOpenForwardOn ly, // CursorType
adLockOptimisti c); // LockType
return rs;
} // end getRecordSetFor ModifyingRecord s function

Jul 19 '05 #3
Looks like you're opening the recordset as ForwardOnly - which is obviously
not updateable !
"Robert Mark Bram" <re********@rem ovethis.optusho me.com.au> wrote in message
news:3f******** **************@ news.optusnet.c om.au...
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:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement. /polyprint/dataEntry.asp, line 158

I fail to understand why there is a syntax error - I am pretty sure all of
the parameters to the Open method are ok..

Any advice would be most welcome!

Rob
:)

function modifyNewslette r()
{
var _newsletter = getParameter ("edition");
var _language = getParameter ("language") ;

var sql = "SELECT * " +
"FROM newsletterText " +
"WHERE (((newsletterTe xt.pageName)='" + _newsletter + "') " + "AND ((newsletterTex t.language)='" + _language + "')) " +
"order by newsletterText. paragraph asc";

var newsletterText = getRecordSetFor ModifyingRecord s (sql);

while (!newsletterTex t.EOF)
{
Response.Write (newsletterText ("text") + " --- " +
newsletterText ("style") + "<br>");

newsletterText ("text") = "changed... ";

// problem statement
newsletterText. Update;

Response.Write (newsletterText ("text") + " --- " +
newsletterText ("style") + "<br>");
newsletterText. MoveNext();
} // end while
// Gets a recordset for modifying records.
// Uses the adLockOptimisti c lock and accepts an sql statement.
function getRecordSetFor ModifyingRecord s (sql)
{
var rs = Server.CreateOb ject ("ADODB.Records et");
rs.Open (sql, // Source
polyprintConnec tion, // ActiveConnectio n
adOpenForwardOn ly, // CursorType
adLockOptimisti c); // LockType
return rs;
} // end getRecordSetFor ModifyingRecord s function

Jul 19 '05 #4

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

Similar topics

7
248480
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 particular surname in a particular town. I can select the records fine with this syntax (testing in Oracle SQL* Plus) SELECT NAMEINFO.LASTNAME, NAMEINFO.FIRSTNAME, NAMEINFO.MIDDLENAME, NAMEINFO.GENDER, ADDRESSINFO.REGION FROM NAMEINFO, ADDRESSINFO...
5
5137
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 However if I update any other column the syntax is fine
4
5325
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 t1.sire_bhid=t2.bhid when not matched then update set t1.sire_bhid=0 go gets the error message:
4
11340
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 AddressDescription of Entity 456 = AddressDescription of Entity_ID 123 Address1 of Entity 456 = Address1 of Entity_ID 123 City of Entity 456 = City of Entity_ID 123
7
6672
by: kosta | last post by:
hello! one of my forms communicates with a database, and is supposed to add a row to a table using an Insert statement... however, I get a 'oledb - syntax error' exception... I have double checked, and the insert works fine (tried to use it from access)... im using visual C# express 2k5... what could be wrong? thanks!
1
3092
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 112: MM_editCmd.ActiveConnection = MM_editConnection Line 113: MM_editCmd.CommandText = MM_editQuery Line 114: MM_editCmd.Execute
6
2690
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 person wants to receive a newsletter and 0 no, don't want to receive it. Now.....when trying to create an UPDATE statement I am running into problems writing the code for it. I had issues before with missing commas but now that the commas are there...
8
8200
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 in syntax error on Update on the statement da.update(mydataset, "DATABASENAME") I do have a primary key on both and copied the code from the working update
1
3370
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 an exception occours which is- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request.
3
4960
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 routine has got me foxed. <?PHP // update.php require("./resources/globals.php") ; require("./resources/common.php") ; //echo $detail;
0
9564
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10148
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10002
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.