• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

String Function error

The code below worked when I used "Request.Form" to capture the form objects and process them.  I installed UploadASP which required me to change the form type to "enctype="multipart/form-data""  Thus I now use "Request.Upload" to capture the form objects.  However, this has caused an error I do not understand.  Why might this no longer work?  Do you see another way to create a loop?  Thanks

Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'Right'
/Warehouse/Shop/admin/updateItem_pro.asp, line 69

      <%
            iID = Upload.Form("iID")
            sql = "SELECT * FROM inventory WHERE iID=" & iID & ";"
            set rs = Server.CreateObject ("ADODB.Recordset")
            rs.open sql, conn, adOpenKeyset, adLockOptimistic
            if not rs.eof or not rs.bof then
                  rs.movefirst
                  %>
      <%
                  for each item in Upload.Form
                  'response.write item & ": "
                                 --  Error --      iName = right(item, len(item)-3)
                        if left(item,3) = "rs_" then
                              if len(Upload.Form(item)) > 0 then
                                    rs(iName) = Upload.Form(item)
                                    'response.write request(item)  & ": " & item & "<br>"
                              'else
                                    'rs(iName) = NULL
                              end if
                        end if
                  next
                  rs.update
            end if
            rs.close
      els

By the way I commented out the code causing the error and wrote out the form objects:  
100-100: 100-100-011: Sweeper: FOR COARSE/ HEAVY SWEEP. TAMPICO FIBERS RESIST HEAT AND CHEMICALS. 2 1/2" TRIM BY 24" WIDE. : : : PLB-20224: EACH: 5: 14.02: 5: 150: 50: : : AIB: 1: Submit:
0
TCCIRM
Asked:
TCCIRM
  • 5
  • 4
1 Solution
 
TCCIRMAuthor Commented:
Ooops... I used "Upload.Form" not "Request. Upload" to capture form objects.
0
 
CWS (haripriya)Commented:
you should use mid() function.

iName = mid(item, len(item)-3, 3)
0
 
TCCIRMAuthor Commented:
No Joy...

Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'Mid'
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
CWS (haripriya)Commented:
try,
for each item in Request.Form
0
 
CWS (haripriya)Commented:
for each item in Request.Form
                  'response.write item & ": "
                                 --  Error --      iName = right(item, len(item)-3)
                        if left(request.form(item),3) = "rs_" then
                              if len(request.Form(item)) > 0 then
                                    rs(iName) = request.Form(item)
                                    'response.write request(item)  & ": " & item & "<br>"
                              'else
                                    'rs(iName) = NULL
                              end if
                        end if
                  next
0
 
TCCIRMAuthor Commented:
That is what it orginally was and worked fine, but when I changed the form type to enctype="multipart/form-data" I had to change Request.Form to Upload.Form to allow the upload function to work as well as capture the form objects for the update.
0
 
CWS (haripriya)Commented:
ok, you should give like this.

upload.form(item) instead of 'item' in that error line.
0
 
RichardPogsonCommented:
The upload form item would seem to have a length less than 3 and the right function is falling off the end of the string hence the error. Was it the item name you wanted to process in which case you want
Right(item.name,len(item.name)-3) If not try writing out each item using On Error Resume Next to see which is giving you greif.
0
 
TCCIRMAuthor Commented:
Good thought...  I changed it to:  iName = right(Upload.Form(item), len(Upload.Form(item))-3)  
and got the following error on the same line:

Persits.Upload.1 error '800a0009'
index out of range.

So..... it looks like the string function correction worked, but I am now back to square one....  hmmmmmm....
0
 
TCCIRMAuthor Commented:
I think I am going to try to rewrite the loop....    thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now