Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: ExecuteNonQuery


Message #1 by steveproctor@c... on Mon, 27 May 2002 21:10:09
I have the same problem with two separate programs involving an update 
command.  I am getting "System.Data.OleDb.OleDbException: Syntax error in 
UPDATE statement" for both and in both the offending line is:

cmdUpdate.ExecuteNonQuery()

Without going into the details, does anyone know of a common/obvious 
error?  By the way, these programs are from SAMS books on ASP.NET and I've 
found other errors in their code.  But I can't find errors in these.  
Thanks.
Steve

Message #2 by Imar Spaanjaars <Imar@S...> on Mon, 27 May 2002 22:19:07 +0200
Hi Steve,

I think the error is related to the SQL statement you are passing to your 
Command object. Most likely a missing ' or space, or an incorrect data type.

If you'd show us the code that builds the update statement, maybe we can help.

Regards,

Imar



At 09:10 PM 5/27/2002 +0000, you wrote:
>I have the same problem with two separate programs involving an update
>command.  I am getting "System.Data.OleDb.OleDbException: Syntax error in
>UPDATE statement" for both and in both the offending line is:
>
>cmdUpdate.ExecuteNonQuery()
>
>Without going into the details, does anyone know of a common/obvious
>error?  By the way, these programs are from SAMS books on ASP.NET and I've
>found other errors in their code.  But I can't find errors in these.
>Thanks.
>Steve


Message #3 by steveproctor@c... on Tue, 28 May 2002 03:13:36
Sorry, I should have done that from the start.

Here's the SQL Update statement:

"Update RMChecks Set Initials=@Initials, Date=@Date, Amount=@Amount, 
To=@To, Client=@Client, Alien=@Alien, File=@File Where Form=@Form"

[on one line in the code]

Thanks for your help.

Steve

> I have the same problem with two separate programs involving an update 
c> ommand.  I am getting "System.Data.OleDb.OleDbException: Syntax error 
in 
U> PDATE statement" for both and in both the offending line is:

> cmdUpdate.ExecuteNonQuery()

> Without going into the details, does anyone know of a common/obvious 
e> rror?  By the way, these programs are from SAMS books on ASP.NET and 
I've 
f> ound other errors in their code.  But I can't find errors in these.  
T> hanks.
S> teve

Message #4 by Imar Spaanjaars <Imar@S...> on Tue, 28 May 2002 08:20:12 +0200
I think you need to post some more code, especially the ASP.NET related 
stuff. Are you executing this directly? Is this the code of a sproc? How do 
you set your parameters?

If you are executing code directly instead of a sproc, you could build the 
SQL statement in code containing the actual values:

Update RMChecks Set Initials = 'ABC' etc etc

and then execute the full statement through the Command object.

HtH

Imar


At 03:13 AM 5/28/2002 +0000, you wrote:
>Sorry, I should have done that from the start.
>
>Here's the SQL Update statement:
>
>"Update RMChecks Set Initials=@Initials, Date=@Date, Amount=@Amount,
>To=@To, Client=@Client, Alien=@Alien, File=@File Where Form=@Form"
>
>[on one line in the code]
>
>Thanks for your help.
>
>Steve
>
> > I have the same problem with two separate programs involving an update
>c> ommand.  I am getting "System.Data.OleDb.OleDbException: Syntax error
>in
>U> PDATE statement" for both and in both the offending line is:
>
> > cmdUpdate.ExecuteNonQuery()
>
> > Without going into the details, does anyone know of a common/obvious
>e> rror?  By the way, these programs are from SAMS books on ASP.NET and
>I've
>f> ound other errors in their code.  But I can't find errors in these.
>T> hanks.
>S> teve


Message #5 by "Dogers" <dogers@t...> on Tue, 28 May 2002 11:10:40 +0100
> At 09:10 PM 5/27/2002 +0000, you wrote:
> >I have the same problem with two separate programs involving 
> an update
> >command.  I am getting "System.Data.OleDb.OleDbException: 
> Syntax error in
> >UPDATE statement" for both and in both the offending line is:

Just to throw another spin on this, I had this error when I first
started asp.net and found it was down to the ASP.Net process not having
write permissions on the database..
-- 
Dogers (dogers@t...)



  Return to Index