Last Record?

Results 1 to 2 of 2

Thread: Last Record?

  1. #1
    Join Date
    Dec 1969

    Default Last Record?

    I am reading data from a text file (line by line) and add some more data (555555200315)(12 DIGITS) to each line then sending to a DB Table... <BR>in the LAST LINE its only adding "555555200315" which is supposed to do based on this code...<BR>BUT - I DO NOT WANT TO WRITE THESE 12 DIGITS(555555200315) IN THE LAST LINE...<BR>Is there any way that i can stop writing these 12 Digits (Please see the Out Put Below)<BR>--------------------------------------------------------------------------------------------------------<BR>Do While ReadFile.AtEndOfStream &#060;&#062; True <BR> ReadLineTextFile = "555555200315"&ReadFile.ReadLine <BR><BR> mySQL = "INSERT INTO TST"<BR> mySQL = mySQL & " VALUES(&#039;"& ReadLineTextFile &"&#039;) "<BR> objConn.Execute(mySQL)<BR>Loop <BR><BR>--------------------------------------------------------------------------------------------------------------<BR><BR>************ "555555200315" - 12 Digits ***************<BR><BR>--------------------- [hl="red"]OUT PUT[/hl] ----------------------------------<BR>555555200315FF9999999999999999999999999<BR>555 555200315FF9999999929999999920000814 555555200315FF9999999999999999999999999<BR>5555552 00315FF9999999999999999999999999<BR>555555200315 &#039;[hl="YELLOW"] I DO NOT WANT TO WRITE THIS RECORD[/hl]<BR><BR>---------------------------------------------------------------

  2. #2
    Join Date
    Dec 1969

    Default After you have read each line...

    ...check whether you&#039;re at the end of the file. If you are, DON&#039;T write the line. As I said, you have to do the check AFTER you read each line.<BR><BR>Do While ReadFile.AtEndOfStream &#060;&#062; True <BR>ReadLineTextFile = "555555200315"&ReadFile.ReadLine<BR><BR>If ReadFile.AtEndOfStream Then<BR>Exit Do<BR>End If<BR><BR>mySQL = "INSERT INTO TST"<BR>mySQL = mySQL & " VALUES(&#039;"& ReadLineTextFile &"&#039;) "<BR>objConn.Execute(mySQL)<BR>Loop<BR><BR>The above could probably be optimized, but I didn&#039;t have time. The principle should be clear though.<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts