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
Line 115: MM_editCmd.ActiveConnection.Close
Line 116:
Source File: C:\Documents and Settings\amit\WebSite1\edit_location.aspx
Line: 114
Stack Trace:
[COMException (0x80040e14): Syntax error in UPDATE statement.]
Microsoft.VisualBasic.CompilerServices.LateBinding .InternalLateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack, Boolean IgnoreReturn) +776
Microsoft.VisualBasic.CompilerServices.NewLateBind ing.LateCall(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean
IgnoreReturn) +193987
ASP.edit_location_aspx.__Render__control1(HtmlText Writer __w,
Control parameterContainer) in C:\Documents and
Settings\amit\WebSite1\edit_location.aspx:114
System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +27
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +53
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +280
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24
The code whre the statement was declared is as follows,
<%
' *** Update Record: construct a sql update statement and execute it
If (Trim(Request("MM_update")) <> "" And Trim(Request("MM_recordId"))
<> "") Then
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " &
MM_recordId
If (Not MM_abortEdit) Then
' execute the update
MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%> 1 3071
note that you are very susceptible to a type of malicious attack called SQL
Injection with the code below. You need to use parameters instead of
building your SQL statement this way.
The error is caused because the SQL statement that you are submitting to the
database is not valid. Look at it in the debugger and see if you can see
the error. You didn't post the actual SQL statement, so it is hard for me
to help.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
<am*******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com... 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 Line 115: MM_editCmd.ActiveConnection.Close Line 116:
Source File: C:\Documents and Settings\amit\WebSite1\edit_location.aspx Line: 114
Stack Trace:
[COMException (0x80040e14): Syntax error in UPDATE statement.]
Microsoft.VisualBasic.CompilerServices.LateBinding .InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn) +776
Microsoft.VisualBasic.CompilerServices.NewLateBind ing.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn) +193987 ASP.edit_location_aspx.__Render__control1(HtmlText Writer __w, Control parameterContainer) in C:\Documents and Settings\amit\WebSite1\edit_location.aspx:114 System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer, ICollection children) +98 System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20 System.Web.UI.Page.Render(HtmlTextWriter writer) +27 System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer, ControlAdapter adapter) +53 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +280 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24
The code whre the statement was declared is as follows,
<% ' *** Update Record: construct a sql update statement and execute it
If (Trim(Request("MM_update")) <> "" And Trim(Request("MM_recordId")) <> "") Then
' create the sql update statement MM_editQuery = "update " & MM_editTable & " set " For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2 MM_formVal = MM_fields(MM_i+1) MM_typeArray = Split(MM_columns(MM_i+1),",") MM_delim = MM_typeArray(0) If (MM_delim = "none") Then MM_delim = "" MM_altVal = MM_typeArray(1) If (MM_altVal = "none") Then MM_altVal = "" MM_emptyVal = MM_typeArray(2) If (MM_emptyVal = "none") Then MM_emptyVal = "" If (MM_formVal = "") Then MM_formVal = MM_emptyVal Else If (MM_altVal <> "") Then MM_formVal = MM_altVal ElseIf (MM_delim = "'") Then ' escape quotes MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'" Else MM_formVal = MM_delim + MM_formVal + MM_delim End If End If If (MM_i <> LBound(MM_fields)) Then MM_editQuery = MM_editQuery & "," End If MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal Next MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then ' execute the update MM_editCmd = Server.CreateObject("ADODB.Command") MM_editCmd.ActiveConnection = MM_editConnection MM_editCmd.CommandText = MM_editQuery MM_editCmd.Execute MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then Response.Redirect(MM_editRedirectUrl) End If End If
End If %> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robert Mark Bram |
last post by:
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:
...
|
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...
|
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
...
|
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...
|
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...
| |
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 ...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |
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,...
|
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |