hello all,
i have 2 datatables and am trying to transfer rows from datatable a to
datatable b
i use the datatable.impor trow method.
the importrow method fails (but does not throw an exception) when
importing a datarow that has numeric columns. columns of type string
are imported fine.
e.g.
Dim objManualDataSe t As DataSet
objMasterDataSe t.Tables.Add(Ne w DataTable(Table Names.Unique_Do B))
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Columns.Add(N ew
DataColumn("dob _key", System.Type.Get Type("System.St ring")))
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Columns.Add(N ew
DataColumn("mn" , System.Type.Get Type("System.In t16")))
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Columns.Add(N ew
DataColumn("dd" , System.Type.Get Type("System.In t16")))
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Columns.Add(N ew
DataColumn("yy" , System.Type.Get Type("System.In t16")))
My 2nd dataset is generated by a call to a sql stored proc and has the
same structure as the 1st dataset..
My code to import the row is:
For Each objRow As DataRow In objManualDataSe t.Tables(2).Row s
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).ImportRow(obj Row)
Next
This is the result:
? objManualDataSe t.Tables(2).Row s(0).ItemArray
{Length=4}
(0): "mn=1dd=12yy=19 55"
(1): 1 {Short}
(2): 12 {Short}
(3): 1955 {Integer}
? objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Rows(0).ItemA rray
{Length=4}
(0): "mn=3dd=29yy=19 73"
(1): {System.DBNull}
(2): {System.DBNull}
(3): {System.DBNull}
Any ideas as to why cols 1, 2, 3 = System.DBNull ?
Thanks in advance
i have 2 datatables and am trying to transfer rows from datatable a to
datatable b
i use the datatable.impor trow method.
the importrow method fails (but does not throw an exception) when
importing a datarow that has numeric columns. columns of type string
are imported fine.
e.g.
Dim objManualDataSe t As DataSet
objMasterDataSe t.Tables.Add(Ne w DataTable(Table Names.Unique_Do B))
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Columns.Add(N ew
DataColumn("dob _key", System.Type.Get Type("System.St ring")))
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Columns.Add(N ew
DataColumn("mn" , System.Type.Get Type("System.In t16")))
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Columns.Add(N ew
DataColumn("dd" , System.Type.Get Type("System.In t16")))
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Columns.Add(N ew
DataColumn("yy" , System.Type.Get Type("System.In t16")))
My 2nd dataset is generated by a call to a sql stored proc and has the
same structure as the 1st dataset..
My code to import the row is:
For Each objRow As DataRow In objManualDataSe t.Tables(2).Row s
objMasterDataSe t.Tables(TableN ames.Unique_DoB ).ImportRow(obj Row)
Next
This is the result:
? objManualDataSe t.Tables(2).Row s(0).ItemArray
{Length=4}
(0): "mn=1dd=12yy=19 55"
(1): 1 {Short}
(2): 12 {Short}
(3): 1955 {Integer}
? objMasterDataSe t.Tables(TableN ames.Unique_DoB ).Rows(0).ItemA rray
{Length=4}
(0): "mn=3dd=29yy=19 73"
(1): {System.DBNull}
(2): {System.DBNull}
(3): {System.DBNull}
Any ideas as to why cols 1, 2, 3 = System.DBNull ?
Thanks in advance
Comment