Solved

Microsoft OLE DB Provider for ODBC Drivers error '80040e14' - [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

Posted on 2009-04-02
7
507 Views
Last Modified: 2012-05-06
Hi guys.
I have a new problem. I'm still working on developing a webdatabase. I develop codes in Dreamweaver CS3 and the database is Access placed on a webhotel.
The problem is on an updateform. I made a lot of similar update-forms and they all work perfect... beside this one. When I click the button to update, I get this error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/crt_survey/crt_survey_edit_note.asp, line 37

Line 37 is the second last line in the code below (MM_editCmd.Execute) I have no idea what is wrong. I used these codes on around 20 other update-pages with no errors. On top of this, this form is the most simple one. Only 1 single field to update! (field = "note" from table="tbl_note").
This issue is driving me nuts! Can you please help me? :o)
Friendly regards
Ullenulle
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

<!--#include file="IsLoggedIn.asp"-->

<!--#include virtual="/Connections/crt_conn.asp" -->

<%

Dim MM_editAction

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))

If (Request.QueryString <> "") Then

  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)

End If
 

' boolean to abort record edit

Dim MM_abortEdit

MM_abortEdit = false

%>

<%

' IIf implementation

Function MM_IIf(condition, ifTrue, ifFalse)

  If condition = "" Then

    MM_IIf = ifFalse

  Else

    MM_IIf = ifTrue

  End If

End Function

%>

<%

If (CStr(Request("MM_update")) = "form1") Then

  If (Not MM_abortEdit) Then

    ' execute the update

    Dim MM_editCmd
 

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")

    MM_editCmd.ActiveConnection = MM_crt_conn_STRING

    MM_editCmd.CommandText = "UPDATE tbl_note SET note = ? WHERE note_id = ?" 

    MM_editCmd.Prepared = true

	MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 255, Request.Form("note")) ' adVarWChar

	MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble

    MM_editCmd.Execute

    MM_editCmd.ActiveConnection.Close

Open in new window

0
Comment
Question by:ullenulle
  • 3
  • 3
7 Comments
 
LVL 11

Expert Comment

by:mildurait
Comment Utility
A couple of ideas.

a) Single quotes around the note column
MM_editCmd.CommandText = "UPDATE tbl_note SET note = '?' WHERE note_id = ?"

b) I would test the values in the forms and check for anomalies such as single quotes etc
Response.write("|" & Request.Form("note") & "|")
Response.write("<br/>|" & Request.Form("MM_recordId") & "|")

0
 

Author Comment

by:ullenulle
Comment Utility
Hi Mildurait.

Ad a) I tried single quotes, but that generated this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/crt_survey/crt_survey_edit_note.asp, line 39

Ad b) The tests were correct. "MM_recordId" were 15 (correct) and "note" did show, what I wrote in the form... but somehow it won't write the stuff to the database.

Any other suggestions?
0
 
LVL 19

Expert Comment

by:daveamour
Comment Utility
What database are you using?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:ullenulle
Comment Utility
Hi. As I wrote I'm using Microsoft Access, and everything else is working fine... just this single, stupid form won't update. :-(  All other forms are updating perfectly.
Friendly regards
Ullenulle
0
 
LVL 11

Expert Comment

by:mildurait
Comment Utility
Have you tried simplifying the command text, even response.writing sql below, copying and running within access?

Dim sql as string
sql = "UPDATE tbl_note SET note = '" & Request.Form("note")  & "' WHERE note_id = " & Request.Form("MM_recordId")

Has this form ever worked?
Is note of string (text/memo) type (not numeric) etc?

0
 
LVL 11

Expert Comment

by:mildurait
Comment Utility
...must fly for 24 hours..
Sabbatarian.
Hope you can find a solution.
0
 

Accepted Solution

by:
ullenulle earned 0 total points
Comment Utility
Hi again. No... it didn't work, so I made another solution that works. I guess this is just "one of those things" that happens. :o) Thanks for your suggestions!
Friendly regards
Ullenulle
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now