Read Txt File Line By Line
I have an encrypted .txt file created by asp. Its formatted with lines etc. Title followed by description underneath. I need to read this into ASP now, and parse it line by line. On each line read, run the function to unencrpt and add line to a new file.
Its the line by line Im having trouble with. If i do the full textstream no formatting takes place coz im adding the fulltextstream all in one addline call. How can I loop through lines ?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Read Cell Data Line By Line From Excel
I had created a macro to read data from an excel sheet and write the values to a text file. I had used "ActiveSheet.Range("GB" & k).Value" command to read the values from the excel.some cells in the excel sheet is having two lines value and four lines data, the text file is generating that value in a single line. (Ex. the cell value in address column is in four lines and should display in four lines in the text file generated from the macro) Can i do something in the excel sheet or in vb script to read the address value line by line and write line by line in text file?
How To Stop It Read The Datas In The Next Line In .csv File
i wrote this code to read the datas from excel(.csv file). but it read all the datas as 1 line. i don't undestand why.is there any function that i can use to stop it read the datas in the next line?? can anyone help me?? thanks a lot. Do While Not TextStream.AtEndOfStream line = TextStream.readline if line <> "" then arr_User(i) = trim(line) splitline = split(arr_User(i), ",") for j=0 to 5 response.Write splitline(j) &"nbsp;nbsp;" next i = i + 1 redim preserve arr_User(i) end if Loop
Read Last Line In Textfile
I wuz just wondering, whats the easiest way to read a text files last line... I know i have to count the lines and put pointer to the last line and read from there.. but i cant get the hang of it heres my code:
Read Adrot Line
I would like to know which ad is being presented through adrotator, so that I may write out some comments about the image presented. Would I use FSO to determine which line of code from the text file is being presented? If FSO is the answer, what would it look like?
Current Line In An ASP File
ASPError object gives the current line where error occurred. Is there a way to find out the line where Err.Number became non-zero due to a Server.CreateObject(...) failure?
Using FSO To Replace A Line In A Text File
I have a text file named "enterintro.bat". The contents of the file are: @ECHO OFF start /w C:skAppActivate.vbs "F4 Event and Entity" start /w Sleep.vbs 2 start /w C:skSendKeys.vbs "BEC201_IPA{TAB}IPA_SS{ENTER}^S" What I'm trying to do is to be able to swap out the "BEC201_IPA" and "IPA SS" with different variables. The format of the text file should never change except for swapping out these values. I've used the OpenTextFile method before, but only to append lines to a file, and never to replace an existing line, and I'm not sure how to do it. The best I've come up with so far is this: Code:
Writing In File Add Extra Line
I am writing one line and for a reason I ignore it adds a line which is screwing up a few things. <% Set fso = CreateObject("Scripting.FileSystemObject") dim sLine sArchivo="switch.txt" path = Server.MapPath("../Flash") sFile = path & "" & sArchivo if fso.FileExists(sFile) then fso.DeleteFile(sFile) end if Set a = fso.CreateTextFile(sFile, True) if request("radiobutton") = 1 then sLine = "&ver=si" else sLine = "&ver=no" end if a.WriteLine (sLine) a.Close sRedirect="admin_NoticiasListado.asp?sRadio=" & request("radiobutton") Response.Redirect(sRedirect) %> How come does the extra line come ? I seems I have done already a fews times and it never ocurred before.
Delete Line From Text File
if I had a form using the input textboxes using username and password. how do I use the .asp language to remove the line from a .txt using the following format: username<space>password
Delete A Line In Text File Or From An Array
I have an Access DB with newsletter preferences in it. What I am trying to do is select small groups to send a custom newsletter out to. So my localhost criteria web page goes to the Access DB and pulls the email addresses that match my current criteria. I then write that list out to a file (newsletterlist.txt). Maybe that is my problem, but I wanted to do that so if my machine crashed while processing, I would know where to recover it. I had looked at arrays and dictionaries but dictionaries aren't good from what I found for hundreds of entries and arrays I can't keep track of..argh. Anyways, I then wanted to loop through the file (newsletter.txt) find the next email address, with it I can query back to the DB and get preferences and assemble the email and out the custom newsletter goes. I've seen where MS says deleting a line using the FileSystemObject is not possible, though wanted to see if anyone has found a work around. Performance isn't that much of an issue for me, as I figured I'd set the thing to running and go to dinner! So anyone have suggestions - even if it means taking the text info to an array, somehow delete one of the addresses and then put it back to a file...anything that can one by one delete the addresses so I know that it all has worked as there would be no email addresses left in the file.
End Of The Line
I have this textarea and I inputted this; Quote: asp xml xhtml If I update/save this to a database(msaccess) and view this in a browser it gives me a one line record like; Quote: asp xml xhtml but I dont want to put every end of the line a <br> tag for me not to view a one line record, how do I do this?
New Line To Br
PHP has a function called nl2br() which inserts HTML line breaks before all newlines in a string. Is there an ASP equivalent to this?
New Line
I've managed to code a function that will straightly replace some given character to another, for security of my pages. For example, I can convert (") to " and (') to ´ ..etc in the form(text field) that allow user to post some data to be stored in the db. But then I don't want the user to write it in HTML tag, and I want that when user press [Enter] on the keyboard, then I can redisplay the message in the way that the user really type in (new line). What I'm thinking is if I can replace the [ENTER] pressing to <br> to be stored in my db. But I didn't found the way I can do that. /n such as in c++ didn't solve. Anybody knows? I use ASP VBscripts/ Does my question clear?
4 Line PHP
I have this small 4 line PHP code and I would really like this to work with ASP, can anyone dp this for me?Code: <?php $tempVar = 'http://www.temp.com'; $feed = file_get_contents($tempVar); header('Content-type: text/xml'); echo $feed;
Err.line
I am trying to trap my ASP errors using the ASP error object. Everything works almost fine, but I can't retrieve the line number where the error occured. Here is a little piece of my code: ========================== If Err <> 0 Then Response.Status = "500 Internal Server Error" Response.Expires = 0 Dim ErrorContent ErrorContent = ErrorContent & "Description: " & Err.Description & vblf ErrorContent = ErrorContent & "Line: " & Err.Line & vblf ErrorContent = ErrorContent & "Number: " & Err.Number & vblf ErrorContent = ErrorContent & "Source: " & Err.Source & vblf
Line Mean
What does this line mean? streamFile.SaveToFile m_sUploadFolder & fileItem.FileName, 2
Line Break
1. I have a form that insterts data in a database 2. I show this information in a pop-up page 3. When the user enter too much content it makes all the pop-up too widther and it breaks the design. I want determinate a specific number of caracters and then do a line break. I guess I need something like this: replace(sql.field,char(10),'<br>') in the way I show my content like this: <%=rs.fields("nombre").value%> How can I do it?
Line Breaks
Im developing a site for an organisation im a member of. Im trying to make updating the site a simple as possible for the organistions staff, some of which are not the computer literate. So i have made a kind of template site where the content of all the pages held in a access db. I have then made an admin backend where organisation staff can login and update the contents of pages simply by editing text in a text box and clicking the update button. However, i've come across a problem. When users leave a line break in the text box the output page doesnt display the gap. I am using a simple response write to display the contents of the attribute on the page. Currently the only way im managing to get line breaks is to enter a '<br>' into the text box on the admin page. How could i make it so when a line is left blank on the text box the database records this and displays it on the output page?
Removing A Line
i have a variable which is like Code: UsrStr = "root|1234" ive checked the text file for it to validate it for removal, if it returns true i need to remove the line and clear that line so new lines can be added in the future. how can i remove a spcified line from the file?
Line Break In SQL Value
We've built a page that allows users to enter items that will ultimately become a list. One particular user enters them into the textarea on the page and for some reason always puts a hard return into the textarea before she submits. This goes into SQL as a line break and it's screwing up how the page renders. How do I find this via code so that I can replace it? I've tried looking for chr(13) + chr(10) and vbCr and vbCrLf and replacing them with "" but it doesn't seem to work. Am I missing something?
Line Breaks
I'm trying to save to a message field with the field type, memo. Say I save the message: "Test 1 Test 2 Test 3" When I response.write it, it will turn out like " Test 1 Test 2 Test 3" losing all the line breaks and such If I response.write it within <textarea> </textarea> tags it comes back
ASP Line Break
if x=1 then response.write("A Man walks into a bar. Ow!") the following ASP VBscript returns the following text: "A man walks into a bar. Ow!" (minus the " marks) How do I make it return the text: "A Man walks into a bar. Ow!" (notice the line break)
One-line Autonumber
A portion of the asp for our site looks like this: Code: insert = "INSERT INTO Students VALUES ( '" & _ (????) CStr ( Request ("UserName") ) & "','" & _ CStr ( Request ("Password") ) & "','" & _ CStr ( Request ("Email") ) & "','" & _ CStr ( Request ("Country") ) & "','" & _ CStr ( Request ("DOB") ) & "','" & _ Date() & "@" & Time() & "','" & _ Date() & "' )" It just inserts a new record into the db. What we did was add an autonumber field to the db, but now it won't update. We know why - because it needs a value for every category in the db - but we don't know how to code it so it will update the db correctly. So, if anyone could help me with the (????) line in the coding so it will correctly update, that would be perfect!
Out Of Memory At Line 30
Had developed a webpage to refresh automatically from one ASP page to another, with the feature of displaying local data that is actively poll & inserted from other remote database servers. The local server is using IIS & Microsoft SQL 2000. I have the problem of "Out of Memory at line 30" after the ASP page has ran for 13 hours, at client machines that is connecting to the server hosting the ASP. However by closing the Internet Explorer and re-open the ASP page, the problem is temporary resolved until another 13 hours later. I think i've had the server objects set to nothing, and had put all queries into sub. I couldn't think of other solution for the problem... Is duplication of sub affecting the performance? Any setting to be done on server, e.g. IIS / SQL? I've attached the ASP file.
Line Graph
I want to generate a Line Graph based on data from Database....
Move Onto Next Line
i have a text area for user to enter remarks. and their remarks can be very very long my output page is a table which i underline the lower boundry of the table. when i wan to output the remarks on this line,it will over shoot the line and page.how do i make it such tat it will move onto the next line?
New Line In Vbscript
How do you write something in a new line?I looked it up on Google, and it seems to be the code vbcr. However, this only returns a white space. I need a NEW LINE. So far, nothing seems to do it.
Line Chart
Can someone provide me sample codes to plot line chart.
New Line Replace
On my page,I have a text box,in which a user can enter text to submit to a MySQL database.For example, a user types: Quote: This is text line 1 This is text line 2 What I want to happen is before it is sent to the database, convert these spaces in between the lines to <BR>'s, so it'll be: Quote: This is text line 1<BR><BR>This is text line 2 If I don't do this, it'll appear (when I query the database) as: Quote: This is text line 1This is text line 2 What code must I use to make this happen?
Filsystemobject Next Line
I'm using the filesystemobject to read textfiles, and that works ok, but i have one problem. I want to read only a single line, fx line 2 in the file. Is it possible to do somting like stream.nextline ?
Delete Until End Of Line
Sample: sql="select * from table order by id" How do I look at the query statement and remove all the characters starting with "order by" and remove all remaining characters in that line?
Line Breaks
I created a form mail script. I am receiving an HTML email from the user input. However, If the user enters a line break in the comments field I am receiveing a single block of text in my email. Is there a way to get the line breaks to show up in the email. I tried Wrap=physical in the input but its still the same.
Quote Line
I am writing an asp app for generating quotes. What I would like to do is allow the user to edit the quote lines without having to open a new page each line. On the quote I have created a loop which goes through the recordset and populates a sort of data grid. Can you use javascript or something so the user can click an edit icon on the appropriate line item in the grid and edit the line details there instead of having to open another page to edit the line item.
Line Number
ive been looking on here for a while and i have to say what a great resource. i wondered if anyone could help me out with a slight problem ive stumbled across today in ssociation with line numbers? im reading the contents of a text file into a variable, and using a regular expression to locate certain criteria, and the number of matches found (main reasoning for reg exps). but i also require the line numbers of each match from my search to take a copy of these lines contents. i think it could be a difficult one, i just wondered if anyone could help out or point me in the right direct?
Line Breaking Off
I am trying to merge 2 strings together from the database to create a meta tag. It comes up as <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="description" content="Looking for Architects in NY? Click here for Architects in New York."><meta name="keywords" content="architect, local, builders, home design, remodelling, construction, Albany County, Albany, Colonie, Saratoga County, Rensselaer County, Troy, Schenectady County, Schenectady, Montgomery County "> It works fine, however the the last "> breaks off to the next line which shouldn't be happening. I tried searching for "<br>" and chr(34) (the carriage return),but there's nothing.
Command LINE
Im trying to use teh command line, for now i just want to do something realllly basic like opening a txt file. and then later i can do some more advanced stuff, but for now i just want to know if i can use the command line, right now i just have Code: <% Dim oShell,sCommand sCommand = "test.txt C:" Set oShell = Server.CreateObject("Wscript.Shell") oShell.Run sCommand, , True Set oShell = Nothing %>
Line Break
I've been trying to add some lines breaks in a ASP email. I've tried with CHR(10) and with vbCrLf. Every test I get the emails without the line breaks. This is how my code is: body = "Name: " & Request.Form("name") & vbCrLf & _ "Email: " & Request.Form("email") & Chr(10) & _ "Manufacturer: " & Request.Form("mnf") & Chr(10) & _ "Category: " & Request.Form("cat") & Chr(10) & _ "Product Description: " & Request.Form("msg")
Writing From Same Line In FSO
I'm using the folowing code to search through a text file using FSO and only response.write the lines that start with "Flow": Code: Do While f.AtEndOfStream = False If left(f.Readline,4) = "Flow" Then response.write f.ReadLine End if Loop after I evaluate a line with the If statement it moves to the next line so I'm always writing the line after the one I want. How do I get away from this?
Select Line
I am having some problems width a little script i downloaded. I'm not able to figure out what he SELECT line does. What does the @@identity mean?Is this maby a javascript? function GetLastIdentity(ADOConnection) { var rstIdentity = Server.CreateObject("ADODB.Recordset"); rstIdentity.Open("SELECT @@identity AS IdentityId", ADOConnection); var iIdentity = rstIdentity.EOF == false ? rstIdentity("IdentityId").value : -1; rstIdentity.Close(); return iIdentity; }
Line Break
I have a cdosys email form but all the text is showing on one line in my email. It should have line spaces between each field. It looks like this Name: Piet Surname: Pompies etc Should be: Name : Piet Surname : Pompies Code: Body = Body & "First Name:" & myfname & vbcrlf Body = Body & "Last Name: "& mysurname & vbcrlf Body = Body & "Comments:" & vbcrlf Body = Body & myComments
Change The Line
let's say I have this string in the DB: s=100,101,102,103 and also id=101 how can I change "s" to be "100,102,103" ?
Subtotal Line
I am working on a summary report with ASP to get the sum number of each field from Access Database. Right now I need to add an subtotal line to the report like this: Region Month Data A 2 1 A 3 2 A 4 3 A Subtotal 6 B 2 2 B 3 2 B Subtotal 4 Total 10 if anyone could like to share their sample subtotal method or code with me to complete this project.
New Line In Cdonts
how do i go to a new sentence in the .body part of CDONTS? all the information I type in for the body is all in one line with no breaks.
How Do You Make If.then.else Do Two Stuff On One Line?
is it possible to do a insert, add, and a redirect all on the same page? for example... signup.asp. there's a text box labeled Acctid. If you don't have an acctid please enter "0000" otherwise enter one. This box is used to see if they have an existing account in the database by using an UPDATE query and if they don't it does an INSERT query with acctid = 0000 for all non customers. What I want the if.then.else statement to do is to If acctid = "0000" then conn.execute acct_add (and if sucessful to response.redirect "/yay.asp" Else if NOT acctid = "0000" then conn.execute acct_update (but I want it to return an error if the update wasn't sucessful either because the acount doesn't exist or watever and if the update was sucessful to response.redirect "/yay.asp") END IF Do ya get it?
Getting Line Number Of Text
I'm trying to find the line number of a specific piece of text: do while textFileOpen.AtEndOfStream=false if textFileOpen.ReadLine=text2Find then foundAt=textFileOpen.Line end if Loop But it keeps giving the wrong line number What I'd like is foundAt to be 0 then if the line is found foundAt is to be the line number, if it is not found stay at 0 In the script above foundAt at increments even though the text isn't in the line? I also get a "Input past end of file" if text2find isn't found
IExplorer Command Line
I want to know IExplore.exe command line options, basically I want the command line equivalent of the following line: Window.open(strUrl, winID, "toolbar=no, scrollbars=yes, location=no, statusbar=no, menubar=no, personalbar=no resizable=yes, left = 50, top = 25");
|