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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top