Home All Groups Group Topic Archive Search About

Ctype Datasource to DataTable .. always empty?

Author
23 Oct 2006 4:43 PM
jobs
The below always results in an empty table, when I know the Gridview
has rows.

Dim dataTable As DataTable = CType(ChargeGridView.DataSource,
DataTable)
        If Not (dataTable Is Nothing) Then   '****** (THIS IS ALWAYS
FALSE) ****

Is there a correct way to do this?

Author
23 Oct 2006 6:00 PM
geno1
I think you should try to display the dataTable of the dataSet that you
originally set the ChargeGridView.DataSource to

say

Dim ds as DataSet
'Fill ds with data
ChargeGridView.DataSource = ds

'now you can access the data in the ds
Dim dataTable As DataTable = ds.tables(0)


Show quoteHide quote
On Oct 23, 12:43 pm, "jobs" <j***@webdos.com> wrote:
> The below always results in an empty table, when I know the Gridview
> has rows.
>
> Dim dataTable As DataTable = CType(ChargeGridView.DataSource,
> DataTable)
>         If Not (dataTable Is Nothing) Then   '****** (THIS IS ALWAYS
> FALSE) ****
>
> Is there a correct way to do this?