Hello all,
I have been working on a relatively straightforward routine to migrate data from one database to another. VB.NET is pretty new to me; I have previously been working with VB6.
I get the routine to read the rows in the source database (srcRow collection) and generate new rows in the target database (trgRow collection) putting the data in the appropriate data fields. Everything seems to go well, except for the fact that the data I pull is not saved in the target database! Here you see an excerpt of the routine:
[navy]
[green]'Iterate source rows[/green]
For Each srcRow In Me.GMDBDataSet.TBL_Mastertable.Rows
[green]'generate new row in target db[/green]
trgRow = Me.GMDB2DataSet.Master.NewMasterRow()
[green]'enter 1 (MMH prefix) in InstitutionCode[/green]
trgRow("InstitutionCode") = 1
[green]'enter 1 (TS prefix) in CollectionCode[/green]
trgRow("CollectionCode") = 1
[green]'copy specimennumber to CatalogNumber[/green]
trgRow("CatalogNumber") = srcRow.Item("SpecimenNumber")
[/navy]
*snip*
[navy]
Next srcRow
MasterBindingSource.EndEdit()
Me.GMDB2DataSet.Master.AcceptChanges()
Me.MasterTableAdapter.Update(Me.GMDB2DataSet.Master)
Console.WriteLine("Done!")
Console.WriteLine("")
[green]'test[/green]
For Each srcRow In Me.GMDB2DataSet.Master.Rows
Console.WriteLine(srcRow.Item("CatalogNumber") & ": " & srcRow.Item("ScientificName"))
Next
[/navy]
The test at the bottom yields no output whatsoever! What did I do wrong!?
Thanks in advance for any help...
Fedor
I have been working on a relatively straightforward routine to migrate data from one database to another. VB.NET is pretty new to me; I have previously been working with VB6.
I get the routine to read the rows in the source database (srcRow collection) and generate new rows in the target database (trgRow collection) putting the data in the appropriate data fields. Everything seems to go well, except for the fact that the data I pull is not saved in the target database! Here you see an excerpt of the routine:
[navy]
[green]'Iterate source rows[/green]
For Each srcRow In Me.GMDBDataSet.TBL_Mastertable.Rows
[green]'generate new row in target db[/green]
trgRow = Me.GMDB2DataSet.Master.NewMasterRow()
[green]'enter 1 (MMH prefix) in InstitutionCode[/green]
trgRow("InstitutionCode") = 1
[green]'enter 1 (TS prefix) in CollectionCode[/green]
trgRow("CollectionCode") = 1
[green]'copy specimennumber to CatalogNumber[/green]
trgRow("CatalogNumber") = srcRow.Item("SpecimenNumber")
[/navy]
*snip*
[navy]
Next srcRow
MasterBindingSource.EndEdit()
Me.GMDB2DataSet.Master.AcceptChanges()
Me.MasterTableAdapter.Update(Me.GMDB2DataSet.Master)
Console.WriteLine("Done!")
Console.WriteLine("")
[green]'test[/green]
For Each srcRow In Me.GMDB2DataSet.Master.Rows
Console.WriteLine(srcRow.Item("CatalogNumber") & ": " & srcRow.Item("ScientificName"))
Next
[/navy]
The test at the bottom yields no output whatsoever! What did I do wrong!?
Thanks in advance for any help...
Fedor