开发者

Simple Question, how to I create a dynamic CSV - ASP.NET, VB

开发者 https://www.devze.com 2023-01-20 08:17 出处:网络
Howdy, Now I\'m a complete newby to .Net and the likes of VB (I\'m more of a Ruby/Rails, PHP kinda guy).

Howdy, Now I'm a complete newby to .Net and the likes of VB (I'm more of a Ruby/Rails, PHP kinda guy).

Anyway I currently have a sub that has a string builder that I'm wish to use as the content of a CSV which I will email later from a webpage. My stringbuilder is creating the content for the CSV but I don't know how to create the CSV dynamically (I don't want the CSV on disk).

  Private Shared Sub BuildClientTrustBalanceCSV(ByVal sb As StringBuilder, ByVal clientsWithTrustBalance As List(Of NonPaymentHistory))

    If clientsWithTrustBa开发者_JAVA技巧lance Is Nothing OrElse clientsWithTrustBalance.Count = 0 Then
      Exit Sub
    End If

    ' need to somewhere create the CSV then inject the StringBuilder into it?

    With sb

      ' create the CSV
      For Each zeroBalanceClient As NonPaymentHistory In clientsWithTrustBalance
        .AppendFormatLine("{0},", zeroBalanceClient.Number)
      Next zeroBalanceClient

    End With


  End Sub

Any ideas? I know I should be able to sort this but .NET just isn't my thing?


Here is a link that might be helpful, but I agree with Oded that the question is misleading.

How do I best generate a CSV (comma-delimited text file) for download with ASP.NET?

0

精彩评论

暂无评论...
验证码 换一张
取 消