Solved

Write data from SQL to CSV file - position

Posted on 2016-08-25
1
63 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 63

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

856 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