J
JDS
I am trying to pass a set of data produced using Linq to a method
requiring a System.Data.DataTable argument. I have tried the
following:
Dim qMaterials = From m in mdbMaterials Select m
Dim dtMaterials As New DataTable
dtMaterials = CType(qMaterials, DataTable)
but I get an error message "Unable to cast object of type ....".
(I can't use Linq in the receiving method because that needs to run
under .Net 2.0).
Is there an easy way to convert a result set from a Linq query to a
DataTable type? Or an alternative solution? (or have I missed the
point?)
requiring a System.Data.DataTable argument. I have tried the
following:
Dim qMaterials = From m in mdbMaterials Select m
Dim dtMaterials As New DataTable
dtMaterials = CType(qMaterials, DataTable)
but I get an error message "Unable to cast object of type ....".
(I can't use Linq in the receiving method because that needs to run
under .Net 2.0).
Is there an easy way to convert a result set from a Linq query to a
DataTable type? Or an alternative solution? (or have I missed the
point?)