Solved

Write data from SQL to CSV file - position

Posted on 2016-08-25
1
45 Views
Last Modified: 2016-08-31
I am trying to create a sub to write fixed lenght to cvs file. Could you help? Max lenght per line is 500.

    Public Sub ExportOrderData()
        Using MyFile1 As New StreamWriter("C:\Temp\MyFile.csv")
         
           position 10 - 15 = write Order #
           position 17 - 25 = write Description
           position 30 - 100 = write Address  

           max size per line is 150


        End Using
    End Sub
0
Comment
Question by:jagr12
1 Comment
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 41771106
Hi  jagr12;

You can use the String.Format Method which will allow you to give field a width value for each specific line position, spaces between columns, how to justify the data in the field and many other options, Have a look at the Microsoft documentation String.Format Method.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now