I have a requirement that I need to query a DB and fetch the records in a Data Table. The Data Table has 20,000 records. 
I need to batch these records in Batches of 100 records each and write these batches into a individual Text files.

Till now I have been able to batch the records in batches of 100 each using IEnumerable(of DataRow).

I am now facing issue in writing the IEnumeable(Of DatRow) to a Text File.

My code is a below:

```
Dim strsql = "Select * from myTable;"
Dim dt as DataTable
Using cnn as new SqlConnection(connectionString)
cnn.Open()
Using dad as new SqlAdapter(strsql ,cnn)
dad.fill(dt)
End Using
cnn.Close()
End Using 

Dim Chunk = getChunks(dt,100)
For each chunk as IEnumerable(Of DataRow) In Chunks
Dim path as String = "myFilePath"
If Not File.Exists(myFilePath) Then
  //** Here I will write my Batch into the File.
End If
Next

Public Iterator Function getChunks(byVal Tab as DataTable, byVal size as Integer) as IEnumerable (Of IEnumerable(of DataRow))

Dim chunk as List(Of DataRow) = New List(of DataRow)(size)
For Each row As DataRow in tab.Rows
chunk.Add(row)
if chunk.Count = size Then
Yield chunk
chunk = New List(of DataRow0(size)
Next
if chunk.Any() Then Yield chunk

End Function

```

Need your help to write the IEneumerable of DataRows into a Text file for each Batch of Records.

Thanks

:)