我有以下代码
Imports System.Data
Public Class ReservationList
Private Sub GuestListToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GuestListToolStripMenuItem.Click
'Show the registration table
GuestListForm.Show()
Me.Hide()
End Sub
Private Sub HighriseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HighriseToolStripMenuItem.Click
' Shows the About Box
highriseAboutBox.Show()
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
' Terminates program
highriseAboutBox.Show()
Me.Close()
End Sub
Private Sub NewReservationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewReservationToolStripMenuItem.Click
' Restarts the program
NewReservationForm.Show()
Me.Close()
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
' terminates program
highriseAboutBox.Show()
Me.Close()
End Sub
Private Sub ReservationList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'CottagesDataSet.Guests' table. You can move, or remove it, as needed.
Me.GuestsTableAdapter.Fill(Me.CottagesDataSet.Guests)
'TODO: This line of code loads data into the 'CottagesDataSet.Reservations' table. You can move, or remove it, as needed.
Me.ReservationsTableAdapter.Fill(Me.CottagesDataSet.Reservations)
End Sub
Private Sub Last_NameLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Last_NameComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Last_NameComboBox.SelectedIndexChanged
End Sub
End Class
当我运行(调试)程序时,我得到了这个
我正在尝试设置父子关系,如下所示:
这是我的.xsd关系
所以我只能告诉你。知道为什么我会收到这个错误吗?一切似乎检查我设置相同的另一个数据库。我也按照书籍教程,没有错过任何东西。我接近抛弃整个想法,但我想让它发挥作用。
由于
答案 0 :(得分:1)
当您遇到某种形式的数据库架构错误时,会出现“无法启用约束”错误。
修复它们:
确保您的主键不允许使用空值,并且尚未存储任何空值。
确保您的'关系'列(姓氏,来宾)非空,并且您尚未存储任何空值。
如果您更改了姓氏,客人可以存储的字符串的长度,在添加数据后,您可能会遇到此处遇到的问题:http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/27aec612-5ca4-41ba-80d6-0204893fdcd1/