We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

VB6 Input command problem with commas

EYoung
EYoung asked
on
Medium Priority
1,582 Views
Last Modified: 2007-11-27
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
Comment
Watch Question

Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009

Commented:
Instead of:

    Input #1, mWork_String1

Try:

    Line Input #1, mWork_String1

(assuming you have one "record" per line)

Author

Commented:
There is one line per record.  Never heard of that option.  What does that do?  (Thanks)
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
"Line Input" reads in the entire line and places it into the "mWork_String1" variable.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Perfect.  Thanks for the quick help.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.