Hello, I have been trying for as long as I can remember to figure out how to use an HTML form to post the input data to a CSV file.
I am a computer teacher trying to have students complete quizzes etc. and have the data auto sent creating entries in a xls, csv, or (hope to avoid) mdb file.
I read about the whole conversation, created multiple form handers based on your code...big help, made progress but I still cant get it to work.
------------------------
"Microsoft VBScript runtime error '800a003e'
Input past end of file
/upload/csvaspFSO.asp, line 19"
------------------------------
I tried your solution with no joy.
************************************************** *********
FORM HANDLER CODE: (with vitals x'd out)
************************************************** ********** - <%
-
dim objFSO, objTXT, lines, newRecord, filePath, fieldNames, x
-
-
filePath = "c:\xxxx\xxxxxxx\xxxxxxx\webroot\upload\csvasp.csv" 'needs absolute path of file
-
set objFSO = server.createobject("Scripting.FileSystemObject")
-
-
set objTXT = objFSO.openTextFile(filePath, 1, False) 'opens a text file for
-
' reading, true means it will create the file if not already there
-
-
if trim(objTXT.readall) <> "" then 'file already existed, is not blank
-
lines = split(objTXT.readall, vbNewLine) 'lines is now an array, each item is
-
' one line of the file
-
fieldNames = split(lines(0), ",") 'now we have a list of the fields in the db.
-
end if
-
-
objTXT.close
-
-
set objTXT = nothing
-
-
set objTXT = objFSO.openTextFile(filePath, 8, True) 'opens the text file for
-
' appending %>
-
<h1>added to the db:</h1>
-
-
<%
-
if trim(fieldNames(1)) <> "" then 'there are already field names in the db,
-
' so put the new line in the same order
-
for each x in fieldNames
-
objTXT.write request.form(x) & "," 'adds each form input to the txtfile
-
'in the order of the fields in the db
-
response.write request.form(x) & "<br>" & vbNewLine
-
next
-
objTXT.write vbNewLine
-
else 'there isn't anything in the textfile yet, so put in the field names first
-
for each x in request.form
-
objTXT.write x & ","
-
response.write x & "<br>" & vbNewLine
-
next
-
objTXT.write vbNewLine
-
-
for each x in request.form
-
objTXT.write request.form(x) & ","
-
response.write request.form(x) & "<br>" & vbNewLine
-
next
-
objTXT.write vbNewLine
-
end if
-
objTXT.close
-
%>
School starts in 2 weeks, PLEASE HELP YOU ARE THE COOLEST MOST HELPFUL AND PATIENT PERSON EVER!!!!!!!
8 2453
well, I'm not the only person here, but it sure looks like my code, so I think you are talking to me. Thank you for your flattery, and welcome to Bytes.
The error says that it tried to do something with the content of the file, but there wasn't any file left. It seems like the most obvious lines that could cause that error are the two listed here as 11 and 13. Could you check which one is line 19 in your code?
If the problem is what I think it is, you can solve it by saving a blank csv to start, or you can put in a csv with one line filled in - could be a dummy entry or whatever. Try that and see if that solves the problem, if it does, let me know and I will try to revise the code to make a better permanent solution.
Jared
Thanks, sorry I got a little busy.
I tried creating the .csv in excel thinking notepad cudda been the issue. As of right now:
ERROR:
Microsoft VBScript runtime error '800a0046'
Permission denied
/csvaspFSO.asp, line 15
***********************************************
LINE 15:
set objTXT = objFSO.openTextFile(filePath, 1, True) 'opens a text file for
************************************************** ********************************
I don't know why this is so difficult,...could this really be an issue of write permissions? The folder does have write permissions set.....
OK...
Moved the ASP to the same writable dir and got new error:
************************************************** **************
ERROR:
Microsoft VBScript runtime error '800a003e'
Input past end of file
/upload/csvaspFSO.asp, line 19
LINE 19:
lines = split(objTXT.readall, vbNewLine) 'lines is now an array, each item is
************************************************** ********************************
I can't thank you enough for your help, I teach youngsters and using google forms is no good bc I cant make a custom redirect after submission, BUT I also have 430 students to track so this will be invaluable to me for data tracking.
Also, should U rewrite the htm? I just borrowed the one from this page to try and learn...really there will be between 4 - 10 text areas (maybe a radio array or two) but thats it. http://ps277.org/upload/csvformtester.htm http://ps277.org/upload/csvaspFSO.asp
Closer to the actual form: http://ps277.org/ps277/tech/typingindex.htm
Rough and incomplete but you can get the idea....
THANKS ANOTHER BAZILLION!!!!!
JHARDMAN (aka code genious super helper)
OK here goes, I reviewed some conversations and this is where I am at:
second ASP: http://marcmolloy.com/upload/csvaspFSO1.asp
to test different code:
dim x
for each x in request.form
response.write x & ": " & request.form(x) & vbNewLine
next
dim objFSO, objTXT, filePath
filePath = "C:\inetpub\csvFiles\myCSVdb.csv" 'change this to whatever your
'path is
set objFSO = server.createobject("Scripting.FileSystemObject")
set objTXT = objFSO.openTextFile(filePath, 1, True)
response.write "<textarea>" & objTXT.readall & "</textarea>"
ERROR NOW READS:
_q1: 5 comments: 55 _q2: 5 CSVFILEIN: template.txt CSVFILEOUT: results.csv _q3: 5 _q4: 5 _q5: 0 _q6: 1 DONESCREEN: http://whatevertheheck.com _q7: 2 _q8: 3 submit: submit
Microsoft VBScript runtime error '800a004c'
Path not found
/upload/csvaspFSO1.asp, line 13
************************************************** ***********
I think it is taking in the data but not writing it to the csv..... what do ya think?
JAHARDMAN (CODE GENIOUS)
Realized I didnt put MY absolute path, changed it and got this:
_q1: 5 comments: 556 _q2: 5 CSVFILEIN: template.txt CSVFILEOUT: results.csv _q3: 5 _q4: 5 _q5: 0 _q6: 1 DONESCREEN: http://whateverthefuck.com _q7: 2 _q8: 3 submit: submit
*****AND a stretchable box with:
class,name,time,errors,message,6,7,8,9
those are the headings from my csv.
BUT NO INPUT DATA....GETTING CLOSER!!! WOOHOO!!!!
switched back to your other code for koolaid82 about FSO text streaming...
long code about 1/5 the way down... http://bytes.com/topic/asp-classic/a...sv-file-server
----gave me an error:
Microsoft VBScript runtime error '800a003e'
Input past end of file
/upload/csvaspFSO1.asp, line 11
LINE 11:
lines = split(objTXT.readall, vbNewLine) 'lines is now an array, each item is
SORRY bout all the readin but I would like to nail this fast so I want to give you as much info as possible....
@garvus
make sure the read/write/modify permissions are set for iusr_<machinename>, that is the user that the script is using.
OK...
Moved the ASP to the same writable dir and got new error:
************************************************** **************
ERROR:
Microsoft VBScript runtime error '800a003e'
Input past end of file
/upload/csvaspFSO.asp, line 19
LINE 19:
lines = split(objTXT.readall, vbNewLine) 'lines is now an array, each item is
************************************************** ********************************
I am fairly certain that this is saying it can't find the file. put the file in place first.
I can't thank you enough for your help, I teach youngsters and using google forms is no good bc I cant make a custom redirect after submission, BUT I also have 430 students to track so this will be invaluable to me for data tracking.
Also, should U rewrite the htm? I just borrowed the one from this page to try and learn...really there will be between 4 - 10 text areas (maybe a radio array or two) but thats it. http://ps277.org/upload/csvformtester.htm http://ps277.org/upload/csvaspFSO.asp
Closer to the actual form: http://ps277.org/ps277/tech/typingindex.htm
Rough and incomplete but you can get the idea....
THANKS ANOTHER BAZILLION!!!!!
I am a firm believer that the HTML is secondary. I always try to get the script working first.
Jared
Sorry, but the write permissions were set to writeable by my host company,they've been fine for a year in the upload folder, that's why I chose it.
iusr_<machinename> Dont know how to do this, but I know that I am able write to that folder. I just checked and the csv file has permissions also.
OK, so "input past end of file" file is in the correct place and proper permissions are set.
For whatever reason it wont ADD the input to the csv !!! AARRRGGGHHH!
OK, let's go back to the version that wrote the field headers to the csv file, that is definitely on the right track. Which version of the code was that?
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics
by: John |
last post by:
Dear all,
I've got a security question that is so difficult that "maybe" there will be
no answer for it. It's regarding protecting asp code.
I did write some asp code, that I sell to...
|
by: Mark |
last post by:
Ok, I know that .net inherently does not share session data across asp.net
projects, but is there any decent work around to this.
We already have a big chunk of our application using the asp.net...
|
by: Jon Paul Jones |
last post by:
For some time now, I have been looking for a build system for ASP.NET that
will merge the file based ease of deployment of classic ASP with the type
saftey and prebuilt nature of ASP.NET with...
|
by: epigram |
last post by:
I've been creating some toy ASP.NET apps in an effort to understand the
technology. I've something odd with regards to project/solution creation.
If you create a new asp.net application, it...
|
by: Conan |
last post by:
Hi,
I am having a problem with .Net / Visual Studio that I can't find the cause
of. I have searched newsgroups and the web and find people with similar but
different (I think) problems. Here's...
|
by: Amelyan |
last post by:
It takes VS 2005 1, 2, and somtimes 3 MINUTES to compile ASP.NET 2.0 website
when external DLL is modified. As a matter of fact, when I click 'Build',
it looks like VS 2005 hangs for most of that...
|
by: Deepblue |
last post by:
I need to develop a webcasting solution. (mostly realtime broadcast) I am
considering the apache/php vs iis/asp.net. I am a MSFT guy myself (vc++, vb6,
asp.net) but new to multimedia(video...
|
by: Stimp |
last post by:
I'm trying to copy an asp.net project onto another computer in order to
work on it from there as well. Whatever way I set up the directory in IIS
the project cannot be run on the new computer (I...
|
by: sreemati |
last post by:
Hi Everyone,
I have newly started as a ASP developer. I have been working on some change request and was blogged down with dynamic includes. Eventually I had managed to figure out the problem and...
|
by: JeremyWoertink |
last post by:
Hi, I'm new to this whole ASP.NET stuff. I was assigned a project at
work to change an application someone else wrote, so I got it all
changed on my local machine, then I copied the files over to...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |