If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > odbc error..AGAIN!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-13-04, 11:58
genocide7 genocide7 is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
odbc error..AGAIN!

Good evening..

i received this error..again! i'm not sure which insert into statement. Could u Please..show me which error and provide the best solution..i'm using dreamweaver mx to generate the sql code thereby i don't know which to modify or change

the error:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/kiosk/komento.asp, line 115


the sql statement :

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/item1.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "salesItem") Then

MM_editConnection = MM_item1_STRING
MM_editTable = "medicItem"
MM_editRedirectUrl = ""
MM_fieldsStr = "itemname|value|distr|value|price|value|date|value "
MM_columnsStr = "ItemName|',none,''|Distributor|',none,''|Price|no ne,none,NULL|Date|',none,NULL"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
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_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

If (Not MM_abortEdit) Then
' execute the insert
Set 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
%>
<html>
<head>
<title>Sales Item</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="<%=MM_editAction%>" method="POST" name="salesItem">

<table width="73%" border="1">
<tr>
<td width="23%">Item Name </td>
<td width="77%"><input name="itemname" type="text" id="itemname" size="50" maxlength="200"></td>
</tr>
<tr>
<td>Distributor</td>
<td><input name="distr" type="text" id="distr" size="50" maxlength="250"></td>
</tr>
<tr>
<td>Price</td>
<td><input name="price" type="text" id="price" size="20"></td>
</tr>
<tr>
<td>Date</td>
<td><input name="date" type="text" id="date" size="20"></td>
</tr>
</table>

<p>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Edit">
</p>

<input type="hidden" name="MM_insert" value="salesItem">
</form>

</body>
</html>
Reply With Quote
  #2 (permalink)  
Old 02-13-04, 13:41
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
What would help would be the evaluated string of MM_editQuery

Just after this string:

MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

Add in this:

Response.Write MM_editQuery

Then run the script... this should write out the fully evaluated string of MM_editQuery to the browser before the error message. Post the results of that string to the forums...
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 02-13-04, 16:58
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Before the INSERT statement is executed, add the following code to print out the statement and then it will help you to find where it is wrong.

Response.Write SQLStatement
Response.End
Reply With Quote
  #4 (permalink)  
Old 04-21-04, 05:10
rosiedong rosiedong is offline
Registered User
 
Join Date: Apr 2004
Location: London, beijing
Posts: 2
Talking reserved words conflict

I think you used microsoft reserved words in you database.
for example, 'date , value'. try to chang them and refresh the database in your dreamweaver. and then change dyn fields in you bonding.
may you good luck.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On