H
hharry
hello all,
i have 2 datatables and am trying to transfer rows from datatable a to
datatable b
i use the datatable.importrow 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 objManualDataSet As DataSet
objMasterDataSet.Tables.Add(New DataTable(TableNames.Unique_DoB))
objMasterDataSet.Tables(TableNames.Unique_DoB).Columns.Add(New
DataColumn("dob_key", System.Type.GetType("System.String")))
objMasterDataSet.Tables(TableNames.Unique_DoB).Columns.Add(New
DataColumn("mn", System.Type.GetType("System.Int16")))
objMasterDataSet.Tables(TableNames.Unique_DoB).Columns.Add(New
DataColumn("dd", System.Type.GetType("System.Int16")))
objMasterDataSet.Tables(TableNames.Unique_DoB).Columns.Add(New
DataColumn("yy", System.Type.GetType("System.Int16")))
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 objManualDataSet.Tables(2).Rows
objMasterDataSet.Tables(TableNames.Unique_DoB).ImportRow(objRow)
Next
This is the result:
? objManualDataSet.Tables(2).Rows(0).ItemArray
{Length=4}
(0): "mn=1dd=12yy=1955"
(1): 1 {Short}
(2): 12 {Short}
(3): 1955 {Integer}
? objMasterDataSet.Tables(TableNames.Unique_DoB).Rows(0).ItemArray
{Length=4}
(0): "mn=3dd=29yy=1973"
(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.importrow 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 objManualDataSet As DataSet
objMasterDataSet.Tables.Add(New DataTable(TableNames.Unique_DoB))
objMasterDataSet.Tables(TableNames.Unique_DoB).Columns.Add(New
DataColumn("dob_key", System.Type.GetType("System.String")))
objMasterDataSet.Tables(TableNames.Unique_DoB).Columns.Add(New
DataColumn("mn", System.Type.GetType("System.Int16")))
objMasterDataSet.Tables(TableNames.Unique_DoB).Columns.Add(New
DataColumn("dd", System.Type.GetType("System.Int16")))
objMasterDataSet.Tables(TableNames.Unique_DoB).Columns.Add(New
DataColumn("yy", System.Type.GetType("System.Int16")))
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 objManualDataSet.Tables(2).Rows
objMasterDataSet.Tables(TableNames.Unique_DoB).ImportRow(objRow)
Next
This is the result:
? objManualDataSet.Tables(2).Rows(0).ItemArray
{Length=4}
(0): "mn=1dd=12yy=1955"
(1): 1 {Short}
(2): 12 {Short}
(3): 1955 {Integer}
? objMasterDataSet.Tables(TableNames.Unique_DoB).Rows(0).ItemArray
{Length=4}
(0): "mn=3dd=29yy=1973"
(1): {System.DBNull}
(2): {System.DBNull}
(3): {System.DBNull}
Any ideas as to why cols 1, 2, 3 = System.DBNull ?
Thanks in advance