Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Record Error in UltraDev

Status
Not open for further replies.

Ladyborg

Programmer
May 11, 2002
208
US
I have a shopping cart working great with Powerclimb extension. Have decided to make it save to table. To do so needed the "insert record" code which was added by DW and uneditted by me. The cart's page shows the following error:

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

[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

/viewcart.asp, line 92


>>>>>>>>>>>>>>>LINE 92 READS
MM_editCmd.Execute


>>>>>>>>>>>>>>>>ENTIRE CODE READS
<%
' *** Insert Record: construct a sql insert statement and execute it

If (CStr(Request(&quot;MM_insert&quot;)) <> &quot;&quot;) Then

' create the sql insert statement
MM_tableValues = &quot;&quot;
MM_dbValues = &quot;&quot;
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),&quot;,&quot;)
Delim = MM_typeArray(0)
If (Delim = &quot;none&quot;) Then Delim = &quot;&quot;
AltVal = MM_typeArray(1)
If (AltVal = &quot;none&quot;) Then AltVal = &quot;&quot;
EmptyVal = MM_typeArray(2)
If (EmptyVal = &quot;none&quot;) Then EmptyVal = &quot;&quot;
If (FormVal = &quot;&quot;) Then
FormVal = EmptyVal
Else
If (AltVal <> &quot;&quot;) Then
FormVal = AltVal
ElseIf (Delim = &quot;'&quot;) Then ' escape quotes
FormVal = &quot;'&quot; & Replace(FormVal,&quot;'&quot;,&quot;''&quot;) & &quot;'&quot;
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & &quot;,&quot;
MM_dbValues = MM_dbValues & &quot;,&quot;
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = &quot;insert into &quot; & MM_editTable & &quot; (&quot; & MM_tableValues & &quot;) values (&quot; & MM_dbValues & &quot;)&quot;

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject(&quot;ADODB.Command&quot;)
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> &quot;&quot;) Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>

ANY IDEAS?
Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
You need to add some trace printout to the page line 85ish

MM_editQuery = &quot;insert into &quot; & MM_editTable & &quot; (&quot; & _
MM_tableValues & &quot;) values (&quot; & MM_dbValues & &quot;)&quot;
response.write &quot;SQL:&quot; & MM_editQuery
response.end

What is the result of this printout?

My guess is that you have used a reserved word as a column name in your table, so the table definition might be of help also.

 
Thanks, but now when I submit, address line reads:

viewcart.asp?UC_SaveCartToTable=1

And blank page says:

SQL:insert into OrderDetails (Username,DateOrdered,ProductQty,ProductID,AddedLogo,ProductName,ProductSize,ProductColor,ProductPrice,LineItemTotal,TotalOrder) values ('user@domain.com',NULL,'1','AP-01','../images/logos/lady02.gif','Apron','One Size','White',32,32,32) Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
OK, new dilemma. Somehow I got past that last one - don't ask, I have NO idea. [pc3]

Another problem I was having was the &quot;update&quot; button wasn't working, I'm guessing because the form action was set to the &quot;submit&quot; button. So, what I did was both useful and necessary.

On viewcart.asp the item quantities can be changed, so I needed a final page where nothing can be changed to be the &quot;submit order now&quot; page. I call it checkout.asp.

It's basically the same form, but no update button and the form's action theoretically SHOULD work for saving the cart to database. HOWEVER............... instead of taking me to the result page which I have named resultcart.asp, I get instead:

/resultcart.asp?UC_SaveCartToTable=1

HELP![gorgeous]
Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
Also, I forgot to mention, on that last one. The page is blank with the following message. Again, I emptied the cart and started over in case the error was due to the cart having been changed since I last used it:

Cart Initialization:
Column Name Array: The number of cart columns defined on this page is inconsistent with the cart stored in the session
Computed Column Array: The number of cart columns defined on this page is inconsistent with the cart stored in the session [gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top