R
RB
VS2008 PPC2003 Emulator, SQL Compact 3.1
The form uses a binding source to the "Orders" table. An
OrderDetailsDataGrid (PK-FK) is also part of this form.
The order form is opened as a new record from an OrdersList form datagrid.
Why wouldn't the following produce an error or save the record into the
database?
================
Try
OrdersBindingSource.EndEdit()
Catch sqlEx As System.Data.SqlServerCe.SqlCeException
MsgBox("EndEdit error saving order: " & sqlEx.ToString())
End Try
Try
OrdersTableAdapter.Update(My_DataSet.Orders)
Catch ex As Exception
MsgBox("Error saving order header: " & ex.ToString())
End Try
My_DataSet.Orders.AcceptChanges()
=======================
Have also tried preceding this with a "OrderDetailsDataGrid.Update" to no
avail.
Only 4 fields are required (no DbNull) and all 4 are filled.
The PK field OrderID is an integer that our code generates as a random
integer that is not already in the database. Autoincrement is set to false
in the table desinger.
The new record appears in the OrdersList datagrid and one can open another
order from the list of orders so the pointer moves off of this order. One
can also add another new order.
However, if an attempt is made to add a line item to the order with the
OrderID as a FK, an error is reported that there isn't a matching PK. Where
is it?
If a query is run to see if the PK exists in the Orders table, it's not
there!
After the end edit, the record can be added using an Insert statement using
the row values that are in the current row of the orders binding source.
The insert adds the row successfully. Where is this record stored and what
is going on?
Any help greatly appreciated!
RB
The form uses a binding source to the "Orders" table. An
OrderDetailsDataGrid (PK-FK) is also part of this form.
The order form is opened as a new record from an OrdersList form datagrid.
Why wouldn't the following produce an error or save the record into the
database?
================
Try
OrdersBindingSource.EndEdit()
Catch sqlEx As System.Data.SqlServerCe.SqlCeException
MsgBox("EndEdit error saving order: " & sqlEx.ToString())
End Try
Try
OrdersTableAdapter.Update(My_DataSet.Orders)
Catch ex As Exception
MsgBox("Error saving order header: " & ex.ToString())
End Try
My_DataSet.Orders.AcceptChanges()
=======================
Have also tried preceding this with a "OrderDetailsDataGrid.Update" to no
avail.
Only 4 fields are required (no DbNull) and all 4 are filled.
The PK field OrderID is an integer that our code generates as a random
integer that is not already in the database. Autoincrement is set to false
in the table desinger.
The new record appears in the OrdersList datagrid and one can open another
order from the list of orders so the pointer moves off of this order. One
can also add another new order.
However, if an attempt is made to add a line item to the order with the
OrderID as a FK, an error is reported that there isn't a matching PK. Where
is it?
If a query is run to see if the PK exists in the Orders table, it's not
there!
After the end edit, the record can be added using an Insert statement using
the row values that are in the current row of the orders binding source.
The insert adds the row successfully. Where is this record stored and what
is going on?
Any help greatly appreciated!
RB