Advertisement

06.09.2008 at 09:14AM PDT, ID: 23469579
[x]
Attachment Details

Export SQL Stored Procedure Result to a Fixed Column Width Text file

Asked by TheUndecider in Miscellaneous Software, Visual Studio .NET 2003

Tags: Microsoft, Visual Studio, 2003

Hello,  I am trying to export the results of a SQL server 2000 stored procedure from my VB.NET application.  So far, I am able to export it with a tab or comma delimiter, but I need to export it as a fixed column witdh text file.    

I first populate a datatable with the stored procedure results and then I loop through each record and generate the file like this:

                With ExportDataSet.Tables(0) ' Exporting the records
                    ' write out each data row
                    For Each row As DataRow In ExportDataSet.Tables(0).Rows
                        'Set the delimiter to an empty string (beggining of the line)
                        delim = ""
                        For Each value As Object In row.ItemArray
                            output.Write(delim)
                            output.Write(value)
                            'Change the delimiter to a tab
                            delim = ControlChars.Tab
                        Next
                        ' write the row
                        output.WriteLine()
                    Next
                End With

Does anyone have an example on how to accomplish this with a fixed column witdh export?

Thanks!
Start Free Trial
[+][-]06.09.2008 at 04:25PM PDT, ID: 21747449

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.10.2008 at 08:27AM PDT, ID: 21752175

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.10.2008 at 09:00AM PDT, ID: 21752459

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Miscellaneous Software, Visual Studio .NET 2003
Tags: Microsoft, Visual Studio, 2003
Sign Up Now!
Solution Provided By: JesterToo
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628