I am using the following to export a DataSet:
Code:
Using saveFileDialogExport = New SaveFileDialog()
    saveFileDialogExport.Filter = "XML Files|*.xml|All Files|*.*"
    saveFileDialogExport.Title = "Export Database"
    saveFileDialogExport.DefaultExt = "xml"
    saveFileDialogExport.AddExtension = True
    saveFileDialogExport.FileName = "database.xml"

    If (saveFileDialogExport.ShowDialog() = DialogResult.OK) Then
        Dim filePath = saveFileDialogExport.FileName
        My.Application.Database.WriteXml(filePath, XmlWriteMode.WriteSchema)
    End If
End Using
I am then using the following to import it back:
Code:
Private Sub ButtonImportData_Click(sender As Object, e As EventArgs) Handles ButtonImportData.Click
    Using openFileDialogImport = New OpenFileDialog()
        openFileDialogImport.Filter = "XML Files|*.xml|All Files|*.*"
        openFileDialogImport.Title = "Import Database"
        openFileDialogImport.DefaultExt = "xml"
        openFileDialogImport.AddExtension = True

        If (openFileDialogImport.ShowDialog() = DialogResult.OK) Then
            Dim filePath = openFileDialogImport.FileName
            My.Application.Database.Clear()
            My.Application.Database.ReadXml(filePath, XmlReadMode.ReadSchema)
            My.Application.Database.AcceptChanges()
            RaiseEvent ImportingData(Me, EventArgs.Empty)
        End If
    End Using
End Sub
But I'm getting this error:
'Invalid 'Key' node inside constraint named: FK_Redacted_RedactedId.'
How the constraint be invalid if I'm importing what I immediately exported?