1.Take number of rows as input from user
2.Loop until all rows are done
3.According to the pattern, number of elements in a row = row number itself. Loop for printing elements in 1 row. If the element number you are printing is odd ,print 1, if it is even print 0.
Start coding and post back if you have any further problems in your code.
Dim Adapter As New OleDbDataAdapter
Dim Command As New OleDbCommand
Dim xFrom As String = dtpFrom.Value.ToString.Substring(0, dtpFrom.Value.ToString.IndexOf(" "))
Dim xTo As String = dtpTo.Value.ToString.Substring(0, dtpTo.Value.ToString.IndexOf(" "))
sqlQuery = MainQuery ...