I have successfully filled a strongly-typeed datatable in my asp.net application (vb). I am able to bind this datatable to a gridview. I need to convert this filled datatable to the equivalent of the filled dataset so I can bind this to a Crystal Report.
Apparently Crystal Reports will not bind to a datatable.
I have successfully filled a strongly-typeed datatable in my asp.net application (vb). I am able to bind this datatable to a gridview. I need to convert this filled datatable to the equivalent of the filled dataset so I can bind this to a Crystal Report.
Apparently Crystal Reports will not bind to a datatable.
Is this possible?
</div>
yes
DataTable dt =
new
DataTable();
DataSet ds =
new
DataSet();
defyant_2004
Member
55 Points
337 Posts
Convert DataTable to Equivalent of DataSet
Feb 20, 2009 01:55 PM|LINK
I have successfully filled a strongly-typeed datatable in my asp.net application (vb). I am able to bind this datatable to a gridview. I need to convert this filled datatable to the equivalent of the filled dataset so I can bind this to a Crystal Report. Apparently Crystal Reports will not bind to a datatable.
Is this possible?
inquisitive_...
Contributor
3421 Points
575 Posts
Re: Convert DataTable to Equivalent of DataSet
Feb 20, 2009 04:59 PM|LINK
Its possible, just create a dataset and add the datatable to the datatablecollection of the dataset.Use the new dataset for your report.
DataSet myDataSet = new DataSet()
DataTable myTable = new DataTable("MyTable");
myTable.Columns.Add("ID", typeof(int));
myTable.Columns.Add("Name", typeof(string));
myDataSet.Tables.Add(myTable);
while(1)
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: Convert DataTable to Equivalent of DataSet
Feb 20, 2009 05:18 PM|LINK
yes
DataTable dt = new DataTable(); DataSet ds = new DataSet();ds.Merge(dt);
Contact me
defyant_2004
Member
55 Points
337 Posts
Re: Convert DataTable to Equivalent of DataSet
Feb 20, 2009 06:55 PM|LINK
The merge is exactly what I needed!!! Thanks again!!.
Neeraj Yadav
Member
45 Points
71 Posts
Re: Convert DataTable to Equivalent of DataSet
Dec 07, 2012 07:32 AM|LINK
Use in this way.......
</div>