Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1444
  • Last Modified:

VB6 Input command problem with commas

I have written a VB6 application that reads in a fixed length text file and populates a MS SQL Server database with the information.  Below is the command I use to read the file:

        Open Projects_File For Input As #1
        Do Until EOF(1)
            Input #1, mWork_String1
 
            ...(process the records)
           
            DoEvents
        Loop
        Close #1

Periodically, the input text file has a comma in one of the fields and when that happens, everything from the comma on is ignored - not read in.  I don't understand why that happens in a fixed length file.  I can see commas causing a problem in a .cscv input file, but this is a fixed length file.

Anyway, the mWork_String1 variable never receives any data after the comma and that means I am dropping data.

This is causing problems with importing of the data.  Does anyone have any idea about how to fix this problem?  Any work-around?

Thanks
0
EYoung
Asked:
EYoung
  • 2
  • 2
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Instead of:

    Input #1, mWork_String1

Try:

    Line Input #1, mWork_String1

(assuming you have one "record" per line)
0
 
EYoungAuthor Commented:
There is one line per record.  Never heard of that option.  What does that do?  (Thanks)
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
"Line Input" reads in the entire line and places it into the "mWork_String1" variable.
0
 
EYoungAuthor Commented:
Perfect.  Thanks for the quick help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now