how do i add filtered rows into a datatable?

C

Craig G

i have a filter that runs on a dataset

Dim drFilteredRows As DataRow()
drFilteredRows = dsResults.Tables(0).Select(strFilter)

This works grand and returns records

but i want to add these rows into a datatable setup as follows

Dim dtDataTable As New DataTable

dtDataTable.Columns.Add("Code")
dtDataTable.Columns.Add("Description")

i thought i could just do the following

dtDataTable.Rows.Add(dsResults.Tables(0).Select(strFilter))

but this doesnt seem to work because when i then try to bind it to a grid

grdGrid.DataSource = dtDataTable
grdGrid.DataBind()

it simply shows the data as "System.data.datarow" in the first cell of the grid for each row
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top