Forums

ASP

This topic is locked

An error has occured during record update!

Posted 21 Dec 2006 10:23:37
1
has voted
21 Dec 2006 10:23:37 Oisin O Gallachoir posted:
The following code is from a test page using Pure ASP Upload 3. It returns an error as follows:

> An error has occured during record update!

> There are no fields to update ...
> If the file upload field is the only field on your form, you should make it required.
> Please correct and try again

I am unable to fix this issue, any advice or help would be welcome.

Here is the code, using MS Access as DB.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/Connections/directory.asp" --><!--#include file="../ScriptLibrary/incPU3Class.asp" -->
<!--#include file="../ScriptLibrary/incPU3Utils.asp" -->
<%
'*** Pure ASP File Upload 3.0.6
' Process form addimage
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "../ScriptLibrary"
pau.ConflictHandling = "uniq"
pau.StoreType = "file"
pau.UploadFolder = ""
Dim uploadaddfile
set uploadaddfile = pau.AddField("addfile"
uploadaddfile.UploadFolder = """images/thumbs"""
uploadaddfile.AllowedExtensions = "GIF,JPG,JPEG,BMP,PNG" ' "images"
pau.ProcessUpload
pau.SaveAll
%>
<%
' *** Edit Operations: (Modified for File Upload) 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 (UploadQueryString <> "" Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(UploadQueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: (Modified for File Upload) set variables

If (CStr(UploadFormRequest("MM_update") = "addimage" And CStr(UploadFormRequest("MM_recordId") <> "" Then

MM_editConnection = MM_directory_STRING
MM_editTable = "LINKS"
MM_editColumn = "LINK_ID"
MM_recordId = "" + UploadFormRequest("MM_recordId" + ""
MM_editRedirectUrl = "c_p.asp"
MM_fieldsStr = "addfile|value"
MM_columnsStr = "LINK_IMAGE|',none,''"

' create the MM_fields and MM_columns arrays
MM_columnsStr = FixColumnsForUpload(MM_fieldsStr,MM_columnsStr)
MM_fieldsStr = FixFieldsForUpload(MM_fieldsStr,MM_columnsStr)
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(UploadFormRequest(MM_fields(MM_i)))
Next

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

End If
%>
<%
' *** Update Record: (Modified for File Upload) construct a sql update statement and execute it

If (CStr(UploadFormRequest("MM_update") <> "" And CStr(UploadFormRequest("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
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
%>
<%
Dim rsLinks__MMColParam
rsLinks__MMColParam = "1433"
If (Request("MM_EmptyValue" <> "" Then
rsLinks__MMColParam = Request("MM_EmptyValue"
End If
%>
<%
Dim rsLinks
Dim rsLinks_numRows

Set rsLinks = Server.CreateObject("ADODB.Recordset"
rsLinks.ActiveConnection = MM_directory_STRING
rsLinks.Source = "SELECT * FROM LINKS WHERE LINK_ID = " + Replace(rsLinks__MMColParam, "'", "''" + ""
rsLinks.CursorType = 0
rsLinks.CursorLocation = 2
rsLinks.LockType = 1
rsLinks.Open()

rsLinks_numRows = 0
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>addimage</title>
<script type="text/javascript"><%=pau.generateScriptCode()%></script>
<script src="../ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>

<body>
<table width="515" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><form action="<%=MM_editAction%>" method="post" enctype="multipart/form-data" name="addimage" id="addimage">
<label>
<input name="addfile" type="file" id="addfile" />
</label>
<label>
<input type="submit" name="Submit" value="Submit" />
</label>
<input type="hidden" name="MM_update" value="addimage">
<input type="hidden" name="MM_recordId" value="<%= rsLinks.Fields.Item("LINK_ID".Value %>">
</form> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
<%
rsLinks.Close()
Set rsLinks = Nothing
%>

Replies

Replied 17 Apr 2007 20:10:34
17 Apr 2007 20:10:34 Deb shaw replied:
Hi Did you ever get this resolved as I am getting the same error and can not resolve it no matter what I try...

Thanks
Debbie

Reply to this topic