Thanks for the help Arne!
It makes more sense now :)
I usually code all of my stuff in ASP.NET VB, but I am trying this project
in C# for the heck of it.
tblItemV1 = CreateTable("tblItems",strDBV1, tblItemV1);
tblItemV2 = CreateTable("tblItems",strDBV2, tblItemV2);
.....
DataRow rowV2 = tblItemV2.NewRow();
foreach(DataRow row in tblItemV1.Rows)
{
foreach(DataColumn col in tblItemV1.Columns)
{
switch(col.Caption)
{
case "SourceID":
rowV2[col] = row[col];
break;
That's what I'm curently using at the momemt. However, I can't add the
object 'col' to rowV2 because 'col' isn't from that table, but both
tables have the column SourceID. I know I could do this with a for loop,
but there should be a way of doing it this way as well.
Any help or pointers would be great, thanks!!
/RT
"Arne Janning" <sp*****************@msn.com> wrote in message
news:Ok**************@TK2MSFTNGP10.phx.gbl...
Hi Ryan,
"Ryan Ternier" <rt******@icompasstech.com> schrieb
DataRow rowV2 = tblItemV2.NewRow();
foreach(DataRow row in tblItemV1)
{
It should be
foreach(DataRow row in tblItemV1.Rows)
Your next foreach won't work either:
it should be:
foreach (DataRow row in tblItemV1.Rows)
{
foreach (DataColumn col in tblItemV1.Columns)
{
switch(col.Caption)
{
}
}
}
Cheers
Arne Janning
foreach(DataColumn col in row)
{
switch(col.Caption)
{.....
I keep getting errors on the first foreach(DataRow row in tblItemV1)
telling me :
foreach statement cannot operate on variables of type
'System.Data.DataTable' because 'System.Data.DataTable' does not contain
a definition for 'GetEnumerator', or it is inaccessible
Any help on this would be sooo sweet.
Thanks!