Hi!

It's easy to add Columns into DataSet DataTable for example like this way
...

ds.Tables("MyTable").Columns.Add("MyColumn", GetType(Integer))

... but how can I remove this column of the DataSet which was created
earlier by code? Do I have to create whole new DataSet table again?

I mean something like ds.Tables("MyTable").Columns.Remove("MyColumn") -
ofcource it's not possible to do like this way :)

I tried ... ds.Tables("MyTable").Columns("MyColumn").Dispose() ... but it
doesn't seem to do what I want.

--
Thanks in advance!

Mika

Re: DataTable column question by ClayB

ClayB
Thu Jun 17 04:21:20 CDT 2004

Try this to see if it does what you want.

dim col as DataColumn =
ds.Tables("MyTable").Columns("MyColumn")

ds.Tables("MyTable").Columns.Remove(col)

===========================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools



"Mika M" <mika.mahonen@nospam_kolumbus.fi> wrote in message
news:%23GRPCuEVEHA.3596@tk2msftngp13.phx.gbl...
> Hi!
>
> It's easy to add Columns into DataSet DataTable for example like this way
> ...
>
> ds.Tables("MyTable").Columns.Add("MyColumn", GetType(Integer))
>
> ... but how can I remove this column of the DataSet which was created
> earlier by code? Do I have to create whole new DataSet table again?
>
> I mean something like ds.Tables("MyTable").Columns.Remove("MyColumn") -
> ofcource it's not possible to do like this way :)
>
> I tried ... ds.Tables("MyTable").Columns("MyColumn").Dispose() ... but it
> doesn't seem to do what I want.
>
> --
> Thanks in advance!
>
> Mika
>
>



Re: DataTable column question by enrico

enrico
Thu Jun 17 04:27:30 CDT 2004

this works here

Dim d As New DataTable

d.Columns.Add("mycolumn")

d.Columns.Remove("mycolumn")

HTH

"Mika M" <mika.mahonen@nospam_kolumbus.fi> wrote in message
news:#GRPCuEVEHA.3596@tk2msftngp13.phx.gbl...
> Hi!
>
> It's easy to add Columns into DataSet DataTable for example like this way
> ...
>
> ds.Tables("MyTable").Columns.Add("MyColumn", GetType(Integer))
>
> ... but how can I remove this column of the DataSet which was created
> earlier by code? Do I have to create whole new DataSet table again?
>
> I mean something like ds.Tables("MyTable").Columns.Remove("MyColumn") -
> ofcource it's not possible to do like this way :)
>
> I tried ... ds.Tables("MyTable").Columns("MyColumn").Dispose() ... but it
> doesn't seem to do what I want.
>
> --
> Thanks in advance!
>
> Mika
>
>



Re: DataTable column question by Mika

Mika
Thu Jun 17 05:36:30 CDT 2004

Oh boys! I was really like ...

ds.Tables("MyTable").Columns.Remove("MyColumn")

I did it correct way earlier. In fact problem was few lines before this line
:)

Sorry for bothering with this!