Click here to Skip to main content
14,875,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to export data from DataSet to CSV format with headers. My dataset will have more that 100 records, so I want only 10 records to be exported to CSV file.

I tried exporting to CSV file, but all the data from dataset is exported.

Is there any way to export only 10 records (10 records is a user choice, it can be 10 or 20,...)

Thanks,
Imran
Posted
Updated 25-Aug-10 8:07am
v3
Comments
Dalek Dave 25-Aug-10 10:24am
   
Minor edit for Grammar.

If you are looping through the records and exporting them one by one, it should be a simple matter of doing something like:

VB
For i As Integer = 0 To ExportCount - 1
    Export(MyDataSet.Tables(0).Rows(i))
Next


Or, try moving the subset of records you want to export into a second dataset and exporting that. But without seeing your code, it is difficult to give a meaningful answer.
   
&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;code&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;cscscscscscsc&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;code&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;pre lang=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;a href=""&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;a href=""&amp;amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;amp;amp;gt;[&amp;amp;amp;amp;amp;amp;lt;a href="" target="_blank"&amp;amp;amp;amp;amp;gt;^&amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;gt;]"c#"&amp;amp;amp;amp;gt;&amp;amp;amp;lt;pre lang="c#"&amp;amp;amp;gt;&amp;amp;amp;lt;pre lang="c#"&amp;amp;amp;gt;&amp;amp;lt;pre lang="c#"&amp;amp;gt;&amp;amp;lt;pre lang="c#"&amp;amp;gt;&amp;amp;lt;pre lang="c#"&amp;gt;&amp;lt;pre lang="c#"&amp;gt;&amp;lt;pre lang="c#"&amp;gt;&amp;lt;pre lang="c#"&amp;gt;&amp;lt;pre lang="c#"&gt;&lt;pre lang="c#"&gt;&lt;pre lang="c#"&gt;&lt;pre lang="java"&gt;&lt;pre lang="java"&gt;&lt;pre lang="java"&gt;&lt;pre lang="java"><small><big><pre></pre></big></small></pre></pre></pre></pre></pre></pre></pre></pre></pre></pre></pre></pre></pre></pre></pre></pre></code></code>
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900