473,386 Members | 1,801 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,386 software developers and data experts.

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 modifyNewsletter()
{
var _newsletter = getParameter ("edition");
var _language = getParameter ("language");

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

var newsletterText = getRecordSetForModifyingRecords (sql);

while (!newsletterText.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 adLockOptimistic lock and accepts an sql statement.
function getRecordSetForModifyingRecords (sql)
{
var rs = Server.CreateObject ("ADODB.Recordset");
rs.Open (sql, // Source
polyprintConnection, // ActiveConnection
adOpenForwardOnly, // CursorType
adLockOptimistic); // LockType
return rs;
} // end getRecordSetForModifyingRecords function
Jul 19 '05 #1
3 6205
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********@removethis.optushome.com.au> wrote in message
news:3f**********************@news.optusnet.com.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 modifyNewsletter()
{
var _newsletter = getParameter ("edition");
var _language = getParameter ("language");

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

var newsletterText = getRecordSetForModifyingRecords (sql);

while (!newsletterText.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 adLockOptimistic lock and accepts an sql statement.
function getRecordSetForModifyingRecords (sql)
{
var rs = Server.CreateObject ("ADODB.Recordset");
rs.Open (sql, // Source
polyprintConnection, // ActiveConnection
adOpenForwardOnly, // CursorType
adLockOptimistic); // LockType
return rs;
} // end getRecordSetForModifyingRecords function

Jul 19 '05 #2
Try response.writing 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 (((newsletterText.pageName)='" + _newsletter + "') "sql
= sql +
sql = sql + "AND ((newsletterText.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********@removethis.optushome.com.au> wrote in message
news:3f**********************@news.optusnet.com.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 modifyNewsletter()
{
var _newsletter = getParameter ("edition");
var _language = getParameter ("language");

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

var newsletterText = getRecordSetForModifyingRecords (sql);

while (!newsletterText.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 adLockOptimistic lock and accepts an sql statement.
function getRecordSetForModifyingRecords (sql)
{
var rs = Server.CreateObject ("ADODB.Recordset");
rs.Open (sql, // Source
polyprintConnection, // ActiveConnection
adOpenForwardOnly, // CursorType
adLockOptimistic); // LockType
return rs;
} // end getRecordSetForModifyingRecords function

Jul 19 '05 #3
Looks like you're opening the recordset as ForwardOnly - which is obviously
not updateable !
"Robert Mark Bram" <re********@removethis.optushome.com.au> wrote in message
news:3f**********************@news.optusnet.com.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 modifyNewsletter()
{
var _newsletter = getParameter ("edition");
var _language = getParameter ("language");

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

var newsletterText = getRecordSetForModifyingRecords (sql);

while (!newsletterText.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 adLockOptimistic lock and accepts an sql statement.
function getRecordSetForModifyingRecords (sql)
{
var rs = Server.CreateObject ("ADODB.Recordset");
rs.Open (sql, // Source
polyprintConnection, // ActiveConnection
adOpenForwardOnly, // CursorType
adLockOptimistic); // LockType
return rs;
} // end getRecordSetForModifyingRecords function

Jul 19 '05 #4

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

Similar topics

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...
7
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...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
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...

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.