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 .....

View Replies


ADVERTISEMENT

How To Upload A File From A String

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.

View Replies View Related

Split For String

there is a method to split a string with a delimiter

checkDelete = Request("checkDelete")
arrayDelete = Split(checkDelete, ",")

my string is Trim(arrayDelete(i)), that has the format "number_number".
I want to put the two numbers in two different variables.

View Replies View Related

Add A String After Split

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?

Code: ....

View Replies View Related

Split A 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.

View Replies View Related

Split A String With No Delimiter

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?

eg split 12345

into 5 array elements of:

1
2
3
4
5

View Replies View Related

Split String Into Pages

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 ....

View Replies View Related

Split A String Which Stores A Mac Address

I have a field which stores a maccaddress. It has a constant length of 12 characters.

e.g 000000000012

When reading from the database and displaying that field I want to display it in the following format:

00-00-00-00-00-00-12.

So I want to split the string and add a "-" after every two characters.

Can you please tell me how this can be done?

View Replies View Related

Split String At A Certain Number Of Character

I have an input text area on a form the max field size in the database is 255 i need to split the string at the 250 caracter?

View Replies View Related

Split String Alpha Vs Numeric

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.

Code: ....

View Replies View Related

Pop Up Message And Split The String Into Two Line

Can anyone please tell me how can i do the pop up message in ASP without blank the background of the page when the pop up message pop up?

Besides that, how can i split the string in one line into two line by using asp?

for example if i wan to split the

"science computer"
into
"science"
"computer"

View Replies View Related

Data From A String ... Split Into Separate Strings

I need to get data from a string that is like:

2_1
34_1
126_3

I need the numbers on the left in one string and then the numbers on the right that needs to be in a separate string.

View Replies View Related

Split String To Perform Multiple Insert

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.

Curently inserst like :-

View Replies View Related

Collect String From HTTP Form POST

I have a basic form that POSTs data to a web server. The web server then replys with a string response. It goes something like this:

<FORM METHOD=POST ACTION="https://www.mywebserver.com/trans.dll">
<INPUT TYPE=HIDDEN NAME="x_Field1" VALUE="1">
<INPUT TYPE=HIDDEN NAME="x_Field2" VALUE="True">
<INPUT TYPE=HIDDEN NAME="x_Login" VALUE="MyUser">
<INPUT TYPE=SUBMIT VALUE="Click here To Submit">
</FORM>

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??

View Replies View Related

Upload File & Forms

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.

View Replies View Related

HTTP File Upload Using SSL

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?

View Replies View Related

Select Mutliple & File Upload In Forms

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.

View Replies View Related

String Functions Run On Empty String

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: ....

View Replies View Related

Text String To A Interger String

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

View Replies View Related

File ID Query String Question

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?

View Replies View Related

Connection String From Include File ASP To SQL Server 2000

I am working on a App. at my work place, now wanting to set it up at home
but for some reason I keep getting this error :

ADODB.Command (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable
range, or are in conflict with one another.

I did some research on the NET but I am still unable to figure out why I
cannot connect to my db. Code:

View Replies View Related

Batch File: Passing A String Variable To Sql Script Results In Truncation

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:

View Replies View Related

Upload Problem (Split From PDF)

I try to use freeaspupload to upload files with two page. one is upload.asp

<form method="POST" action="upload02.asp" enctype="multipart/form-data">
<input type="file" name="attach1" size="20"><br>
<textarea rows="5" cols="20" name="note"></textarea>
<p><input type="submit" value="send" name="B1"></p>
</form>

the other is upload02.asp

<!-- #include file="freeASPUpload.asp" -->
<%
uploadsDirVar= server.MapPath("files")
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
%>


but it fails,what's the problem?

View Replies View Related

CSV Readline

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

View Replies View Related

HTTP Upload

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?

View Replies View Related

Upload Excel With Macros Using HTML File Upload

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?

View Replies View Related

Split Up Source File

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.

View Replies View Related

How To Split Path And Get File Name

i want to trim the given path and get the file name with its extenstion:

i.e. only get the "XPIcon.jpg" in the following example

URLImage = "D:Documents and SettingsAdministratorDesktopXPIcon.jpg"

Note: the URLImage is always chaning, its not constant.

View Replies View Related

SPLIT FROM LDB File Stays On Server. CAN Be Deleted

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?

View Replies View Related

Regular Expression :: Split By Comma (CSV File)

I have a sting that have to be split by comma (cvs file)

Let me give you an example:

this is my string:
asd,asd,asd,"asd,asd,asd",asd,asd

I have to split this string but the string that is in quote I dont whant to be splited

result have to be like that:

Array(
[0]=>asd
[1]=>asd
[2]=>asd
[3]=>"asd,asd,asd"
[4]=>asd
[5]=>asd
)

View Replies View Related

SPLIT FROM Launching MS Word To Open File From A Hyperlink?

How would this be done for something like a text editor?

For example, say I wanted to launch a text editor from a hyperlink AND also the file I wanted to open with the editor as as well?

View Replies View Related

String Contains ?

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.

View Replies View Related

ADO LIKE 'string'

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.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved