Home All Groups Group Topic Archive Search About

master/details & UpdateCommand problem

Author
11 Dec 2006 2:54 PM
Peter Demeyer
I have a simple database with 3 tables:

customers(id, name)
articles(id, description)
sales(customerID, articleID, date)

and one view called articles_and_sales:
SELECT * FROM articles, sales WHERE sales.articleID=article.ID

Customer names should appear in a combobox
Articles.description and sales.date must appear in one datagridview and
are dependent on the chosen customer in the combobox.

I'm using BindingSources between these two controls and their
DataTables.

Now, in order to make the datagrid dependent on the combobox, I set the
combobox's bindingsource to the articles_and_sales view and the
datagridview's bindingsource to the combobox's bindingsource and as
datamember, I chose the relationship between this View and the
Customers table .

Everything works fine, the datagridview listens to the combobox, but my
problem is that I don't know how to update Articles or Sales.
The table adapter of this view doesn't have an updatecommand by
default, and the wizard won't let you make one either, so I tried
making one (to update at least the Articels table in this view, and I
though I'd make a second Updatecommand later to update the Sales
table), but my update command fails with "parameter ?_3 does not have a
default value".
I have the feeling there must be better ways to achieve this, instead
of trying to update a view etc., but I'm not too experienced with
things.
Any help would be greatly appreciated!

AddThis Social Bookmark Button