Web Forms / HTTP File Upload / String.Split A StreamReader.ReadLine() String
I'm developing an Asp.NET system to take a CSV file uploaded via the web, parse it, and insert the values into an SQL database. My sticking point comes when I try to split() the string returned by readline() on the file.
The following code snippet works for me:
tokens = "one,two,three,four".Split(",")
for each token in tokens
response.write("<td>"+token+"</td>")
next
However, if I take the next line in the CSV, read using StreamReader.ReadLine on the PostedFile.InputStream, I receive "Object reference not set to an instance of an object." which I have narrowed down to be my string holding the line. Further investigation reveals that no other string member functions work on my line (.ToCharArray, .ToString, etc).
I suspect that StreamReader.ReadLine is not correctly returning a string, even though Response.Write(line) displays what I would expect .....
I am using ASP. I would like to take a string that stores HTML code and write that as an HTML file onto my web directory.
I know if I had an html file on my local computer it could be uploaded without a problem via ASP Upload. But since my text is a string I need to create a new file. Problem is that most web servers have somewhat strict permissions for web files. But programs like ASP Upload seem to get around them.
If I can't find a way to write the file directly via my script due to permission issues. Perhaps there is a clever way I can write the file using an FTP component. Of course I will still need to find a place I can write the file so that I can transfer it unless someone knows of a program that will FTP a file and create it from a string.
I have an array which I split and then add the values into a table. In total there are 3 values in the array, two integers and one string. The integers are put smoothly but the string is not. Is it possible to add the string?
how to do the following. Split a string var at each separate leter and then make an array out of it in asp(vb script). jump the cursor between textboxes automatically.
i.e tpye one letter into input field with a max length of 1 and then automatically tab to the second. The end result being able to type a whole word without looking up but still have the letters separated.
I know you can use the split function to split a comma delimited string but i want to split a string of numbers which have nothing delimiting them. Is there any way to do this?
I was wondering if it's possible to split a long string, taken from the database, into several pages. Just like the paging function but instead of rows in database you define the amount of rows in the string.. if it exceeds say 5 rows, then it will show a "Next" -button to contine showing the next 5 rows and so on ....
I have a text file that I'm reading into a SQL table, from there I need to run various scripts on it to clean it up. One being, there is field that comes in as:
ie: JNJG12345 MAN5678 XY4656565
I need to split this by Alpha characters, then Numeric characters and be able to input them into seperate fields as such:
JNJG 12345 MAN 5678 XY 4656565
I have managed to locate a script that Memnoch came up with: http://forums.aspfree.com/t24666/s....ht=split+string that managed to get me where I am now.
How do I get the loop to stop once it finds the first occurence of a number? Below is the code I am using.
I have the belwo code which i mean to do an multiple checkbox insert. I have managed to get it so i puts all the checkbox values into a string seperated by a comma, and it insert into a database, however just not how i need it to.
The response is just a comma separated values string like: 1,0,2,3,0,Transaction Success,Etc
Once I hit the submit button the server returns a string response. I do not want the user to ever see the response, but need the response string to create my own page. How do I retreive that string and use it??
I am using a basic ASP script to allow users to request a resource using an online.I use the Request.Form methods a lot in the script but at the end of it I want to send an email with an attachment from the client PC.I have tried using the BinaryRead function to upload the file sucessfully however mixing it with forms that get information from a previous page/step using Request.Form fails.
I know this is an issue however does anyone know of a really easy way of continuing to use the Form and uploading a file.
There are numerous methods of uploading files using HTTP. Is all that's necessary to get secure file upload would to reference a web page containing the appropriate html file upload code using https?
I have <select muliple> in one of my update forms - ASP. This update form also handles a file upload (enctype="multipart/form-data"). The problem is I am not getting the mutiple values of the select option after submission. Only the value of the first option selected is retrieved. How can I fix this or modify the script to get all the values selected.
I have a form in which several elements are expected to be all digits. Some of those elements can be left empty, but if specified they must be all digits. I have this Sub to edit them: ....
I am pulling info from a sql server By default the query pulls back the inforamtion as text.Therefore when I go to calculate some figures its giving me a type mismatch error. Is there a function in can call to convert a text string to an integer string using
rstSearch.Fields("name").Value .To pull back the info in a for loop
Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch
When you see sites using a file id system such as this:
www.website.com/?id=11515
how are they doing that?
I know its a query string but do they have each and every file include or what not written in or are these files entered into a database/SQL and they have an ID assigned to them that calls certain files?
I have a batch file that takes variables from the cmd and passes them by sqlcmd to an SQL script. When I pass the variable 'MikeTestList' the script runs as expected with no problems. When I passed 'BulkTransferTest' I got an error message, 'The string or binary data will be truncated'.
Some testing has shown that I get the error when the string is anything above 12 characters. Is there a limit to the length of a string you can pass using sqlcmd from a batch file? Is there any way around it?
Also, if I have a space in the string, it only passes the string up to the space. I have tried to fill it with a '%' which then gets passed as is, so the % stays in place through out the script. Code:
My .csv file has only one column, and is filled with mail addresses. The purpouse of this aplication is to read the csv mail, check if exists in one database, and return me a eof value. See.Code:
Set objeto = CreateObject("Scripting.FileSystemObject") archivo = Server.MapPath("pathfile.csv") set CSV = objeto.OpenTextFile(archivo, forReading )
data=csv.readline() query = "select * from table where mail = '%" & data & "%'" recordset.open query, conn response.write recordset.eof Never, no matters if the exact mail exist or not, the value of EOF is true. It never finds a comparative in the database. I dont know what can it be.. I suppouse something with variables, like data should be "trimmed", or something else.
And, of course, if I write in the screen both values, they are exactly the same
I'm having problems with timeouts on HTTP uploads. I set the session timeout property to zero, but it still didn't work. Is there a way to set the timeout to never expire?
We face problems uploading excel (with macros) documents using HTML File Upload.
The file contents are corrupted while viewing the same. However, we are able to upload excel (w/o. macros) documents successfully. Is there anything we have to take care of, while handling uploads of excel documents with macros?
This is not really language specific but more of a source code parsing. I have a large ASP source file that I like to split up, resulting in separate ASP files, each containing one function and the filename named after that function. Does anyone know of a tool/script which does this? PS: I am too lazy to learn Perl/AWK/Python to do this, hence why I believe someone has already written a tool/script to do this. Possibly in C++/etc.
I just recently moved from a shared account to a private server. On the shared account, everything worked fine, but after transferring every file as it was before, onto the new server, without any changes to code, the ldb files now won't disappear on their own, like they did on the shared hosting account.
I can manually delete them, but am wondering if there is a server setting that needs to be configured in order for it to delete the ldb files upon closing of the database?
Will these ldb files cause problems in performance if not deleted properly?
If a visitor doesn't put anything in the "Search" text box I'd like them to be redirected to where they came from before the search form forwarded them to the search.asp page. Therefore I've put the following at the top of search.asp to do this.
I am trying to search my access database for a string using LIKE and a wildcard. Example:
Code:
Dim con
con = "SELECT names.* WHERE name LIKE 'sam*'"
For some reason this gives me no results even though I verified there is entries with the word sam in them.
Also tried using % instead of *. Also took out wildcard. I can search for an integer without a problem though, when I try a string, regardless if there's relevant entries I get nothing back at all.