Print Page | Close Window

ODBC Error 80040e10 - can’t find the prob

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=534
Printed Date: 28 March 2026 at 11:59pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: ODBC Error 80040e10 - can’t find the prob
Posted By: ladyborg
Subject: ODBC Error 80040e10 - can’t find the prob
Date Posted: 26 February 2003 at 10:31am

Hi,

I have a db driven page and am getting the following error: 

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

The area of code in question reads:

<%

set cmdMsg = Server.CreateObject("ADODB.Command")
cmdMsg.ActiveConnection = MM_cnTOforum_STRING
cmdMsg.CommandText = "UPDATE MESSAGES  SET MSG_READ_COUNT  = MSG_READ_COUNT + 1  WHERE MSG_ID = varID "
cmdMsg.CommandType = 1
cmdMsg.CommandTimeout = 0
cmdMsg.Prepared = true
cmdMsg.Execute()

%>

I know this error pertains to a missing or mistyped field name in the db, but everything is typed correctly.

Help!




Replies:
Posted By: Gary
Date Posted: 26 February 2003 at 12:17pm

cmdMsg.CommandText = "UPDATE MESSAGES  SET MSG_READ_COUNT  = " & MSG_READ_COUNT + 1  & " WHERE MSG_ID = varID "

That is asssuming MSG_READ_COUNT is in fact a variable which is defined/dserived further up the page.



Posted By: MorningZ
Date Posted: 26 February 2003 at 12:35pm
i assume "varID" is some sort of variable in ASP... if it is, your syntax is all wrong

cmdMsg.CommandText = "UPDATE MESSAGES SET MSG_READ_COUNT = MSG_READ_COUNT + 1 WHERE MSG_ID = " & varID

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Gary
Date Posted: 26 February 2003 at 12:36pm

Oops - I missed that one.

 



Posted By: ladyborg
Date Posted: 26 February 2003 at 12:48pm

Thank you so much for the help, I'm a newbie at this.

I made the &varID change, now I get the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'MSG_ID ='.

 



Posted By: ladyborg
Date Posted: 26 February 2003 at 12:49pm

Should that be

"&varID"

instead of "&varID

?



Posted By: MorningZ
Date Posted: 26 February 2003 at 12:54pm
why do you think that?

you need to answer that question first... because you could go back and forth all day with people on the forums trying to teach you that you are trying to build a SQL string, and having varID in quotes tells ASP to take that literally, not "replace with the value of the variable"

and if you don't have that variable assigned anywhere, you are going to through that error.....

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Gary
Date Posted: 26 February 2003 at 2:39pm

This should do the trick (hopefully).....

cmdMsg.CommandText = "UPDATE MESSAGES  SET MSG_READ_COUNT  = " & MSG_READ_COUNT + 1  & " WHERE MSG_ID = " & varID

If varID is text rather than numeric (integer) then use this.....

cmdMsg.CommandText = "UPDATE MESSAGES  SET MSG_READ_COUNT  = " & MSG_READ_COUNT + 1  & " WHERE MSG_ID = '" & varID & "'"



Posted By: MorningZ
Date Posted: 26 February 2003 at 2:48pm
i wouldnt suggest breaking out of the string to do "MSG_READ_COUNT", its very obvious by the SQL statement that all it is supposed to do is increment the database column "MSG_READ_COUNT" by 1, so there is no need to dynamically set that value in ASP, the only thing needed to be fed in is the identifier of the message

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Gary
Date Posted: 27 February 2003 at 4:04am

It depends whether MSG_READ_COUNT is a column within the db table or an asp variable.

I suppose a little more info (ie db table structure) from ladyborg would help sort this one out.



Posted By: MorningZ
Date Posted: 27 February 2003 at 8:31am
ummm, i am not trying to cause trouble or nothing, but notice the SQL statement..

cmdMsg.CommandText = "UPDATE MESSAGES SET MSG_READ_COUNT = MSG_READ_COUNT + 1 WHERE MSG_ID = " & varID

notice the part in bold.. its a column in the database

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Gary
Date Posted: 27 February 2003 at 8:34am

Ok, ok, I give in.

Except that maybe, just maybe, she created an asp variable with the same name as the column name. (but I doubt it very much).



Posted By: ladyborg
Date Posted: 28 February 2003 at 10:50am
Nope, there's no variable with same name as column name.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net