|
|
|
start date: Thu, 9 Aug 2007 11:46:06 -0400,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Nathan Sokalski
|
|
2
William Vaughn
|
|
3
William Vaughn
|
|
4
Cor Ligthert [MVP]
|
|
5
Cor Ligthert [MVP]
|
Adding columns to a new DataTable
I have a new DataTable that I want to add columns to. I have found that you
need to do this using the DataColumnCollection class, but I am still having
trouble doing this. Can somebody give me an example? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
Date:Thu, 9 Aug 2007 11:46:06 -0400
Author:
|
Re: Adding columns to a new DataTable
On page 535 you'll find an example kinda like this:
Dim dt As New DataTable
Dim dc As New DataColumn("MyColumnName", GetType(Integer))
dt.Columns.Add(dc)
The DataTable can be a new one (like this) or an existing DataTable
populated by Fill or Load.
hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Nathan Sokalski" wrote in message
news:uIsEmxp2HHA.2064@TK2MSFTNGP03.phx.gbl...
>I have a new DataTable that I want to add columns to. I have found that you
>need to do this using the DataColumnCollection class, but I am still having
>trouble doing this. Can somebody give me an example? Thanks.
> --
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansokalski.com/
>
Date:Thu, 9 Aug 2007 09:03:12 -0700
Author:
|
Re: Adding columns to a new DataTable
On page 535 you'll find an example kinda like this:
Dim dt As New DataTable
Dim dc As New DataColumn("MyColumnName", GetType(Integer))
dt.Columns.Add(dc)
The DataTable can be a new one (like this) or an existing DataTable
populated by Fill or Load.
hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Nathan Sokalski" wrote in message
news:uIsEmxp2HHA.2064@TK2MSFTNGP03.phx.gbl...
>I have a new DataTable that I want to add columns to. I have found that you
>need to do this using the DataColumnCollection class, but I am still having
>trouble doing this. Can somebody give me an example? Thanks.
> --
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansokalski.com/
>
Date:Thu, 9 Aug 2007 09:03:12 -0700
Author:
|
Re: Adding columns to a new DataTable
Nathan,
As addition to Bill:
Be aware that using the standard procedures an added column will never be
written to the database.
Cor
"William Vaughn" schreef in bericht
news:OIFPK7p2HHA.5160@TK2MSFTNGP05.phx.gbl...
> On page 535 you'll find an example kinda like this:
>
> Dim dt As New DataTable
> Dim dc As New DataColumn("MyColumnName", GetType(Integer))
> dt.Columns.Add(dc)
>
> The DataTable can be a new one (like this) or an existing DataTable
> populated by Fill or Load.
>
> hth
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant, Dad, Grandpa
> Microsoft MVP
> INETA Speaker
> www.betav.com
> www.betav.com/blog/billva
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
> Visit www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> -----------------------------------------------------------------------------------------------------------------------
>
> "Nathan Sokalski" wrote in message
> news:uIsEmxp2HHA.2064@TK2MSFTNGP03.phx.gbl...
>>I have a new DataTable that I want to add columns to. I have found that
>>you need to do this using the DataColumnCollection class, but I am still
>>having trouble doing this. Can somebody give me an example? Thanks.
>> --
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansokalski.com/
>>
>
Date:Mon, 13 Aug 2007 12:42:57 +0200
Author:
|
Re: Adding columns to a new DataTable
Nathan,
As addition to Bill:
Be aware that using the standard procedures an added column will never be
written to the database.
Cor
"William Vaughn" schreef in bericht
news:OIFPK7p2HHA.5160@TK2MSFTNGP05.phx.gbl...
> On page 535 you'll find an example kinda like this:
>
> Dim dt As New DataTable
> Dim dc As New DataColumn("MyColumnName", GetType(Integer))
> dt.Columns.Add(dc)
>
> The DataTable can be a new one (like this) or an existing DataTable
> populated by Fill or Load.
>
> hth
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant, Dad, Grandpa
> Microsoft MVP
> INETA Speaker
> www.betav.com
> www.betav.com/blog/billva
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
> Visit www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> -----------------------------------------------------------------------------------------------------------------------
>
> "Nathan Sokalski" wrote in message
> news:uIsEmxp2HHA.2064@TK2MSFTNGP03.phx.gbl...
>>I have a new DataTable that I want to add columns to. I have found that
>>you need to do this using the DataColumnCollection class, but I am still
>>having trouble doing this. Can somebody give me an example? Thanks.
>> --
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansokalski.com/
>>
>
Date:Mon, 13 Aug 2007 12:42:57 +0200
Author:
|
|
|