kfirba
Well-known member
- Joined
- Dec 29, 2012
- Messages
- 77
- Programming Experience
- 1-3
Hello!
As a practise, I started to build a MINI library application.
Finally, I have understood how to use queries and parameters.
My problem is, When i attempt to add a row into a table, I get the following error:
the code that i try to commit:
The table structure is like that:
http://www.siz.co.il/my/0e0nzdqznwu3.jpg
The tables relations are Cascade because I need it like that
Thanks in advance!
As a practise, I started to build a MINI library application.
Finally, I have understood how to use queries and parameters.
My problem is, When i attempt to add a row into a table, I get the following error:
ForeignKeyConstraint CostumersBorrows requires the child key values (111111111) to exist in the parent table.
the code that i try to commit:
VB.NET:
borrowerID = cboCostumers.SelectedValue bookID = lstBooks.SelectedValue
Dim BorrowDR As DataRow = borrowDS.Tables("Borrows").NewRow()
BorrowDR.Item("CostumerID") = borrowerID
BorrowDR.Item("BookID") = bookID
BorrowDR.Item("BorrowDate") = Now()
BorrowDR.Item("BorrowEnd") = False
borrowDS.Tables("Borrows").Rows.Add(BorrowDR)
Me.BorrowsTableAdapter1.Update(borrowDS.Tables("Borrows"))
Me.BooksTableAdapter1.UpdateBookStatus(bookID)
The table structure is like that:

http://www.siz.co.il/my/0e0nzdqznwu3.jpg
The tables relations are Cascade because I need it like that
Thanks in advance!