A
Aziz
Hello, my main VB .NET 2003 + Access program wasn't working so I
created two small sample applications to test why I get the following
error:
ForeignKeyConstraint ProductOrder_Product requires the child key values
(AAA-BBB-1) to exist in the parent table.
My first application works and creates a child record fine. My second
application is almost exactly the same but it doesn't work (I get the
above error, even though I KNOW for a fact that the value does exist in
the parent table). Can anyone help me if I send them the source code?
The code is very small (only around 10 lines). No matter what I try it
seems I'm banging my head against a harder than brick wall.
Here's the code though:
Private Sub btnPlaceOrder_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnPlaceOrder.Click
Dim drOrder As DataRow = Turboset.Orders.NewRow()
drOrder.Item("ShippingName") = "Gah"
drOrder.Item("CustomerID") = 7
Turboset.Orders.Rows.Add(drOrder)
daOrders.Update(Turboset, "Orders")
'Gets OrderID of last added new Order row
Dim lastOrderID As Integer
lastOrderID =
CInt(Turboset.Orders.Rows(Turboset.Orders.Rows.Count -
1).Item("OrderID"))
Dim drOrderProduct As DataRow = Turboset.OrderProduct.NewRow
drOrderProduct.Item("OrderID") = lastOrderID
drOrderProduct.Item("ProductID") = "1"
Turboset.OrderProduct.Rows.Add(drOrderProduct)
daOrderProduct.Update(Turboset, "OrderProduct")
End Sub
If someone can help me I can send them the zip file (it's only around
350kB) which includes the databases too.
Or you can get it here:
http://ultrashare.net/hosting/fl/ce6e2268b8/
http://rapidshare.de/files/17722654/help.zip.html
Thanks.
created two small sample applications to test why I get the following
error:
ForeignKeyConstraint ProductOrder_Product requires the child key values
(AAA-BBB-1) to exist in the parent table.
My first application works and creates a child record fine. My second
application is almost exactly the same but it doesn't work (I get the
above error, even though I KNOW for a fact that the value does exist in
the parent table). Can anyone help me if I send them the source code?
The code is very small (only around 10 lines). No matter what I try it
seems I'm banging my head against a harder than brick wall.
Here's the code though:
Private Sub btnPlaceOrder_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnPlaceOrder.Click
Dim drOrder As DataRow = Turboset.Orders.NewRow()
drOrder.Item("ShippingName") = "Gah"
drOrder.Item("CustomerID") = 7
Turboset.Orders.Rows.Add(drOrder)
daOrders.Update(Turboset, "Orders")
'Gets OrderID of last added new Order row
Dim lastOrderID As Integer
lastOrderID =
CInt(Turboset.Orders.Rows(Turboset.Orders.Rows.Count -
1).Item("OrderID"))
Dim drOrderProduct As DataRow = Turboset.OrderProduct.NewRow
drOrderProduct.Item("OrderID") = lastOrderID
drOrderProduct.Item("ProductID") = "1"
Turboset.OrderProduct.Rows.Add(drOrderProduct)
daOrderProduct.Update(Turboset, "OrderProduct")
End Sub
If someone can help me I can send them the zip file (it's only around
350kB) which includes the databases too.
Or you can get it here:
http://ultrashare.net/hosting/fl/ce6e2268b8/
http://rapidshare.de/files/17722654/help.zip.html
Thanks.