Re: Adding a Column fro a DataTable to Another DataTable



"FredC" <FredC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B206C4F4-797B-49E5-B354-0D6D1EE2619F@xxxxxxxxxxxxxxxx
> I'm trying to build a new DataTable from the columns of other DataTables:
>
> DataTable myTable = new DataTable("theData");
>
> myTable.Columns.Add(DataSetTemp.Tables["10MinuteData"].Columns["Date"]);
>
> I get the error - Column 'Date' already belongs to another DataTable -
> I know that already - Whats stopping me from adding this column to new
> DataTable?
>
> Thxs.

Is this Access? Perhaps "Date" is a keyword for your database. If it is
Access try using brackets in the string, if it is another type database that
uses quoted identifiers try escaping some quotes in...

myTable.Columns.Add(DataSetTemp.Tables["10MinuteData"].Columns["[Date]"]);

myTable.Columns.Add(DataSetTemp.Tables["10MinuteData"].Columns["\"Date\""]);

--
============
Frank Hickman
Microsoft MVP
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


.



Relevant Pages