I am using VBscript in ASP. I am trying to address one file in a folder object.
Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject")
' MyFolders is contents of folder containing photos.asp
Set MyFolders=MyDirectory.GetFolder(Server.MapPath("./"))
Then I try to access the first file in the "MyFolder"
I tried
1. Set filefound=MyFiles.files.item(1)
2. Set filefound=MyFiles.files(1)
3. Set filefound=MyFiles.files[1]
Neither work. There is compilation error.
But
For each filefound in MyFiles.files
works
"myfiles.files" is a collection object of file objects, isn't it?
I'm running a stored procedure that inserts a record into a table then returns the Identity field value. I've done this kind of thing plenty of times in the past, but I'm obviously doing something wrong this time..
I've tested the Stored Proc in QA and it works fine. The SQL code runs OK in ASP (iAffected = 1 which shows the record is inserted), but when I try to query the resulting recordset, I get an error:
"Item cannot be found in the collection corresponding to the requested name or ordinal. " Code:
does anyone know how to define own Collection objets in ASP (not ASP.NET!) and VBScript? Is it better to use the Collections or the "Scripting.Dictionary" object?
I am doing a project and I have a form in which I am putting information inside cookies then I am to display the information in the cookies on another page. So when they click submit they goto this page and this is my code:
I found this piece of code to collect info from a form and then display the information. I created seperate programs - one with the form and the other with the asp part to display the collected information.
How can I collect information in one program using "post" method and display it and get an okay from my users before I update the database? Code:
I am processing a form and I want to double check that a field is defined so that no error occurs. How do I check if a key exists in a collection (the Request.Form collection)?I do not want to process all of the fields in the form, so I do not want to use "For Each x In Request.Form". I process a certain list of fields and just in case the field was left out, I want to prevent an error from occurring from trying to use a key that does not exist.
Code:
For Each x In arrayFields 'arrayFields contains certain field names 'verify that field actually defined If [field is a key in the Request.Form collection] Then stringTemp = Request.Form(x) 'do stuff End If Next
I like how you can use the Fields collection to create tables but is there a way to dynamically produce a table and filter out certain fields without having to write the entire table out manually? For example, I don't need the record's ID field in the table.
I'm working on an ASP/Javascript page with frames, and I need to access the properties of an image in the "top" frame from a script launched by the "middle" frame.
When changing the properties in the current frame, I use
I would like to tap in to all the brilliant minds out there through the means of this question. Is it possible to have a function in asp that returns a collection of items?
If so could you please direct me to some code that may provide some insight to how its done. I've tried using my limited coding capacity but no success.
I want to expire a cookie collection in my asp page and I gave it like this;
Response.Cookies("whereq").Expires = Now()
and this "whereq" collection has 50 keys. The problem is my cookie didn't expire from the above code. I hope there should be a way to do so without writing 50 expire lines.
How can I retrieve the values one by one from a variable like this: chgID=48, 51, 52, 53, 54, 56, 57, 59, 58, 46, 61, 60
Actually I am getting this, from a form and I want to update records in database filtering with these IDs one at a time. I guess 'For Each' loop can do this work done, but How??
I am trying to create a string that is cencatenated from values in a form. The form pulls in the values in a reocordset and displays each record in a row with a checkbox.
I want to cencatenate the values of the ProjectName field if the checkbox (isChecked) has been checked when the form is submitted. Here is the code that i am using:
<% If (Request.Form("Submit") <> "") Then Dim Criteria Criteria = "" For Each Item in Request.Form("ProjectName") If Request.Form("IsChecked") Then Criteria = Criteria & Request.Form("Projectname") Else Next Response.write Criteria End If %>
If I get rid of the If then else statement with in the For Each statement, then all of the items will cencatenate. I am just trying to grab the rows where the user has checked in the box for the row.
can anyone tell me why it is that when i do (see the code>)
1 the value of the submit button doent match? 2 the collection returns the collection string as line one? 3. how do i jump these 2 for error check and trim replace?
Is there a way to manipulate (ie change) the items in the forms collection. I simply want to get rid of the infamous apostrophe in input from a form, replace ' with ''. I had hoped to be able just to make the change and then put it back into the Form.item. Is there a way to do this?
If not, would the best way to save the result be to build an array, which is then used instead of the forms collection? Code:
I have several hundreeds of DVDs, and friends often call me to borrow some.
I'd like to be able to have my entire collection on my web page (i have everything in a database already) and let them browse for the title they want, then "check" the ones they need and see if they're "available" or not.
Then this would send me an email with the titles and the name of the person requesting them.
Is there any ready to use solution or should I just jump into developing it myself?
If there is something, any link to a product like that? Something simple: title, cover picture, available or not.
I have an asp page in which i have a combo,in change of selected index of combo i am putting the combo value to a hidden variable then submitting the form like this
form.hid.value=1 form.target; form.submit
and again while loading the form i am checking for the value like this .request.form("hid") but i am not getting the value .what could be the problem.the method of my form is post only.
I have an asp application that I install on quite a few different servers. omally this works fine and I have never had a serious issue with it untill today.I installed the site in the normall way and was able to browse to it. But as soon as I submitted one of the forms in a page, nothing gets passed through the forms collection.
I found this strange and immedatly placed in code to iterate through the collection and display all of the values, but the collection is empty and no variables have been passed at all.
has anybody experinced this issue before and know how to fix it, I have been looking through setting in IE as I though a security update may have changed something, I'm not too sure if this is a browser issue or an IIS issue.
Is the garbage collection algorithm used in JavaScript on ASP based on reference counting or tracing? (I'm planning on creating some user defined Objects with lots of cyclic references (e.g., a.next.prev = a), and would like to know if this will cause a problem for the garbage collector. The fact that garbage collection in general isn't instantaneous suggests to me that it isn't based on reference counting, but I just want to be sure.)
I have a VB6 ActiveX DLL that we use for printing. It iterates through the printers collection to set the printer to the one the user requested. This is called from ASP (VB Script) pages, and from a VB Web Class application. The problem is, sometimes the printers collection is empty, so it fails to print.
The COM+ package is configured to run as a known user. This user has printers configured. If we logon to the Web Server as the known user, and restart component services, then the printers appear and it all works. if we leave the console logged on, it keeps working. If we log the console off, then at some point (overnight), it 'forgets' the printers.
We now have a customer where leaving the console logged on is not an option. And they do not want to logon to 'kick start' it. The first users come in early in the morning, before IT is at work to resolve teh porblem.
This is occuring on Windows 2000 Server, and on Windows 2003 server.
I have tried:
- Searching the web. - Using EnumPrinters instead. This gives the local pronters, but not the network pronters. - (I am trying) using OpenPrinter first. - I have tried to find a way to force the DLL to initialise the security, without success.
While programming in ASP.NET, I'm used to copying out all the contents of the Form collection of the page's Request object, then emptyting the Request.Form collection itself so all my user-supplied values are safe in my "protected" Session Object. I often do the "emptying" with the Request.Form.RemoveAll() method
However, this time around, I'm creatng an ASP 3.0 application (not ASP.NET), and I'd like to reproduce similar functionality. It seems there's no such method as Request.Form.Remove() or Request.Form.Contents.Remove() as I thought I'd find. Can anybody help me with this, or do I have to just stick to my Request.Form collection, since there'd be no point copying out all the values into Session variables if I can't empty the Request.Form collection?
I'm trying to retrieve 2 values from a table (product stocknumber & description) that match a form result (product ID number) to send with the "form results email". Not quite sure how to do this. Code:
in my mail sending page i'm getting the following error
Cannot use Request.Form collection after calling BinaryRead.
can enyone explain y i'm getting that error
here's my coding where i get the error
str2 = split(Request.form("C1"),",") i use the above code to get multiple checkbox values for getting the id's of the users to whom the mail should send
here the mail sending works as a loop while the attachemnt also attached to the mail
I have "DataEntrypage.asp" which is a data entry page(about 250 data elements includes text boxes, radio buttons, check boxes, drop down boxes etc).
After the data validation through javascript(form.action = "ProcessData.asp" )I post this page to "ProcessData.asp" which process all the database transactions like updates, deletes and inserts.
At the begining/top of the "ProcessData.asp" I loop through Request.Form collection and store them in a text file on the WEB SERVER.
Once in a while the whole Request.Form collection is disappearing in the text file. At that instances it is creating the text file with size of 1kb but it is not showing any thing in the file.
I checked and it is not loosing the session information.
I have the below page which i use to add the information from a form to my MySQL database. It works perfectly fine when I don't add the code at the top for sending an email. Can someone be kind and have a look at my code and let me know where I am going wrong.
When I add the email code at the top the error I get is : Error Type: Request object, ASP 0206 (0x80004005) Cannot call BinaryRead after using Request.Form collection. /change_management/area/upload.asp, line 92
upload.asp I use for addding an attachment to the form ....
has anyone got a function or subroutine which will remove blank out or remove email addresses.
i've wrote a function which will remove valid email addresses, it's pseudo addresses such as "blah @ blah.com" or "blah_at_blah_dot_com" or "blah_at_blah_._com"
the function is basically to stop users posting an email address in a message.