<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Tutorial Reading A Text File Using LINQ</title>
	<atom:link href="http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/</link>
	<description>Everything .Net</description>
	<lastBuildDate>Fri, 26 Feb 2010 15:39:54 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Vish</title>
		<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/comment-page-1/#comment-12118</link>
		<dc:creator>Vish</dc:creator>
		<pubDate>Tue, 17 Nov 2009 20:11:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/#comment-12118</guid>
		<description>Hi,

Can you suggest me how can I import a CSV file (pretty large in size) to a SQL DB using Linq in Silverlight ASP .NET project. 

I have written a test app to read the records from the DB and display them on the grid using Linq. 

How would I do bulk insert from such a large file (it has close to 50+ columns)?

Thanks!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Can you suggest me how can I import a CSV file (pretty large in size) to a SQL DB using Linq in Silverlight ASP .NET project. </p>
<p>I have written a test app to read the records from the DB and display them on the grid using Linq. </p>
<p>How would I do bulk insert from such a large file (it has close to 50+ columns)?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/comment-page-1/#comment-11097</link>
		<dc:creator>Deepak</dc:creator>
		<pubDate>Fri, 23 Oct 2009 03:59:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/#comment-11097</guid>
		<description>Andrew,

Thanks for your comment.</description>
		<content:encoded><![CDATA[<p>Andrew,</p>
<p>Thanks for your comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/comment-page-1/#comment-11018</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Wed, 21 Oct 2009 12:43:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/#comment-11018</guid>
		<description>Awesome, thanks exactly what I was looking for.</description>
		<content:encoded><![CDATA[<p>Awesome, thanks exactly what I was looking for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remove Duplicate Lines From A Text File Using LINQ &#124; One .Net Way</title>
		<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/comment-page-1/#comment-631</link>
		<dc:creator>Remove Duplicate Lines From A Text File Using LINQ &#124; One .Net Way</dc:creator>
		<pubDate>Fri, 12 Dec 2008 06:37:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/#comment-631</guid>
		<description>[...] from a text file. Firstly, I read the contents of the file into a collection using an approach I described in an earlier post [...]</description>
		<content:encoded><![CDATA[<p>[...] from a text file. Firstly, I read the contents of the file into a collection using an approach I described in an earlier post [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JabberBoxer</title>
		<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/comment-page-1/#comment-564</link>
		<dc:creator>JabberBoxer</dc:creator>
		<pubDate>Fri, 05 Dec 2008 15:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/#comment-564</guid>
		<description>Just wanted to share the code we used to extend the functionality of your read CSV, this will now read your CSV into multiple objects.

&#039;~ Example of CSV file
&#039;~ &quot;InvoiceNumber&quot;,&quot;InvoiceDate&quot;, &quot;FirstName&quot;, &quot;LastName&quot;
&#039;~ &quot;11111&quot;,&quot;9/1/2008&quot;, &quot;Jerrame&quot;, &quot;Hertz&quot;
&#039;~ &quot;22222&quot;,&quot;9/2/2008&quot;, &quot;John&quot;, &quot;Doe&quot;
&#039;~ &quot;33333&quot;,&quot;9/3/2008&quot;, &quot;Jane&quot;, &quot;Doe&quot;

Imports System.IO

Module Module1
    Sub Main()
        ReadCSV(&quot;c:\test.csv&quot;)
    End Sub
End Module

Module LINQ2CSV
    Public Sub ReadCSV(ByVal FilePath As String)
        &#039;~ Load the values from the CSV file.
        Dim Orders = From line In File.ReadAllLines(FilePath) _
                        Let OrderRecord = line.Split(&quot;,&quot;) _
                        Select New Invoice() _
                        With {.Order = New Order( _
                                                    TrimQoutes(OrderRecord(0)), _
                                                    TrimQoutes(OrderRecord(1))), _
                            .Customer = New Customer( _
                                                    TrimQoutes(OrderRecord(0)), _
                                                    TrimQoutes(OrderRecord(2)), _
                                                    TrimQoutes(OrderRecord(3)))}

    End Sub

    &#039;~ Remove qoutes from string. May be able to avoid this if I use the 
    &#039;~  parse object instead of the the file object.
    Private Function TrimQoutes(ByVal value As String) As String
        Return value.Trim.Replace(&quot;&quot;&quot;&quot;, &quot;&quot;)
    End Function

End Module
&#039;~ Order object.
Public Class Invoice
    Public [Order] As Order
    Public [Customer] As Customer
End Class

Public Class Order
    Public InvoiceNumber As String
    Public InvoiceDate As String

    Public Sub New(ByVal InvoiceNumber As String, ByVal InvoiceDate As String)
        Me.InvoiceNumber = InvoiceNumber
        Me.InvoiceDate = InvoiceDate
    End Sub
End Class

Public Class Customer
    Public InvoiceNumber As String
    Public FirstName As String
    Public LastName As String

    Public Sub New(ByVal InvoiceNumber As String, ByVal FirstName As String, ByVal LastName As String)
        Me.InvoiceNumber = InvoiceNumber
        Me.FirstName = FirstName
        Me.LastName = LastName
    End Sub

End Class</description>
		<content:encoded><![CDATA[<p>Just wanted to share the code we used to extend the functionality of your read CSV, this will now read your CSV into multiple objects.</p>
<p>&#8216;~ Example of CSV file<br />
&#8216;~ &#8220;InvoiceNumber&#8221;,&#8221;InvoiceDate&#8221;, &#8220;FirstName&#8221;, &#8220;LastName&#8221;<br />
&#8216;~ &#8220;11111&#8243;,&#8221;9/1/2008&#8243;, &#8220;Jerrame&#8221;, &#8220;Hertz&#8221;<br />
&#8216;~ &#8220;22222&#8243;,&#8221;9/2/2008&#8243;, &#8220;John&#8221;, &#8220;Doe&#8221;<br />
&#8216;~ &#8220;33333&#8243;,&#8221;9/3/2008&#8243;, &#8220;Jane&#8221;, &#8220;Doe&#8221;</p>
<p>Imports System.IO</p>
<p>Module Module1<br />
    Sub Main()<br />
        ReadCSV(&#8221;c:\test.csv&#8221;)<br />
    End Sub<br />
End Module</p>
<p>Module LINQ2CSV<br />
    Public Sub ReadCSV(ByVal FilePath As String)<br />
        &#8216;~ Load the values from the CSV file.<br />
        Dim Orders = From line In File.ReadAllLines(FilePath) _<br />
                        Let OrderRecord = line.Split(&#8221;,&#8221;) _<br />
                        Select New Invoice() _<br />
                        With {.Order = New Order( _<br />
                                                    TrimQoutes(OrderRecord(0)), _<br />
                                                    TrimQoutes(OrderRecord(1))), _<br />
                            .Customer = New Customer( _<br />
                                                    TrimQoutes(OrderRecord(0)), _<br />
                                                    TrimQoutes(OrderRecord(2)), _<br />
                                                    TrimQoutes(OrderRecord(3)))}</p>
<p>    End Sub</p>
<p>    &#8216;~ Remove qoutes from string. May be able to avoid this if I use the<br />
    &#8216;~  parse object instead of the the file object.<br />
    Private Function TrimQoutes(ByVal value As String) As String<br />
        Return value.Trim.Replace(&#8221;"&#8221;", &#8220;&#8221;)<br />
    End Function</p>
<p>End Module<br />
&#8216;~ Order object.<br />
Public Class Invoice<br />
    Public [Order] As Order<br />
    Public [Customer] As Customer<br />
End Class</p>
<p>Public Class Order<br />
    Public InvoiceNumber As String<br />
    Public InvoiceDate As String</p>
<p>    Public Sub New(ByVal InvoiceNumber As String, ByVal InvoiceDate As String)<br />
        Me.InvoiceNumber = InvoiceNumber<br />
        Me.InvoiceDate = InvoiceDate<br />
    End Sub<br />
End Class</p>
<p>Public Class Customer<br />
    Public InvoiceNumber As String<br />
    Public FirstName As String<br />
    Public LastName As String</p>
<p>    Public Sub New(ByVal InvoiceNumber As String, ByVal FirstName As String, ByVal LastName As String)<br />
        Me.InvoiceNumber = InvoiceNumber<br />
        Me.FirstName = FirstName<br />
        Me.LastName = LastName<br />
    End Sub</p>
<p>End Class</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/comment-page-1/#comment-36</link>
		<dc:creator>Deepak</dc:creator>
		<pubDate>Wed, 13 Aug 2008 10:57:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/#comment-36</guid>
		<description>Mike,

The best thing about LINQ is that it comes with such a small learning curve for C# and VB.NET programmers. And if you have written any SQL then after writing few LINQ queries you feel like you knew it all the time. 

In my case I feel that after a long time something (LINQ) excites me so much that I want to learn every little detail about it.</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>The best thing about LINQ is that it comes with such a small learning curve for C# and VB.NET programmers. And if you have written any SQL then after writing few LINQ queries you feel like you knew it all the time. </p>
<p>In my case I feel that after a long time something (LINQ) excites me so much that I want to learn every little detail about it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Borozdin</title>
		<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/comment-page-1/#comment-35</link>
		<dc:creator>Mike Borozdin</dc:creator>
		<pubDate>Wed, 13 Aug 2008 10:51:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/#comment-35</guid>
		<description>I&#039;m really fascinated by the fact that LINQ can be used in a great variety of scenarios.

I remember I was a bit confused when I saw it for the first time. I was primary frustrated by the fact that the first operator was &quot;from&quot; and &quot;select&quot; was the last one. But then I understood the reasons.</description>
		<content:encoded><![CDATA[<p>I&#8217;m really fascinated by the fact that LINQ can be used in a great variety of scenarios.</p>
<p>I remember I was a bit confused when I saw it for the first time. I was primary frustrated by the fact that the first operator was &#8220;from&#8221; and &#8220;select&#8221; was the last one. But then I understood the reasons.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/comment-page-1/#comment-34</link>
		<dc:creator>Deepak</dc:creator>
		<pubDate>Wed, 13 Aug 2008 10:44:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/#comment-34</guid>
		<description>Thanks Mike</description>
		<content:encoded><![CDATA[<p>Thanks Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Borozdin</title>
		<link>http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/comment-page-1/#comment-33</link>
		<dc:creator>Mike Borozdin</dc:creator>
		<pubDate>Wed, 13 Aug 2008 10:38:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/tutorial-reading-a-text-file-using-linq/#comment-33</guid>
		<description>Nice :-)!</description>
		<content:encoded><![CDATA[<p>Nice :-)!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
