I'm having some difficulty wrapping my hands around a problem I am
having....
Here is the situation, I'll use the classic "Customers / Invoices"
example to explain it. I'm displaying a list of customers on a form
(call it Form1) using a grid control. No problem.... It displays a
subset the data as I need it, etc. I'm primarily using this for just
display.
I have another form (call it Form2) that I want to use for editing the
"Customer" and "Invoices" (and other related data) using bound controls
Right now, it is setup so that when the user double clicks the entry
in Form1, it passes the key onto Form2. Form2 has the necessary data
adapters & dataset setup so that it uses a parameter to query the DB
using the key passed from Form1. This works just fine. I can edit the
entry, save it, etc. No problem.
Where I am running into a problem is trying to add a new "Customer."
Ideally, I want to have a "Add new" button on Form1 which of course
launches a blank Form2. If the user cancels, the no record would get
added. Right now, I cannot seem to get the databound controls on Form2
to bind to a new record.
Right now, when adding a new entry, I have it setup so when the Form2
loads, it runs the parametrized query so that it returns no records. I
then manually add a new datarow to the dataset's table. I've tried
using CurrencyManager or BindingManagerBase to set the current record
to the new entry, with no luck.
If I add bogus data when I add the new record, then perform in update,
it gets written to the database, OK. I just can't seem to get it to
bind properly to the controls.
(Using MS Access database - BTW)
Any thoughts / suggestions?
Matt A.
|