DataGridView / who to update tables with FKs

  • Thread starter Christopher Schlüter
  • Start date
C

Christopher Schlüter

Hello,

i'm using VB.net 2008 Express with SQL Server 2008 SP1.
I'm trying to create a winfows app.

I use a DataGridView to display colums from several joined tables. (using
dataset, datatable und datadadapter)
How can i update the data in the DB? The update method can't be created by
the tableadapter when using inner joins.

Is there a best practice how to display and update normalized DB tables?

Thx

Chris
 
G

Gregory A. Beamer

I use a DataGridView to display colums from several joined tables.
(using dataset, datatable und datadadapter)
How can i update the data in the DB? The update method can't be
created by the tableadapter when using inner joins.

Is there a best practice how to display and update normalized DB
tables?


Create queries and/or stored procedures to call for the update and call
these queries instead of trying to use the Update() method. For any
insert, you will have to insert parent tables first, or it will blow due
to not respecting constraints.

I love the drag and drop in Visual Studio, but there are times when you
get past the point where the autogenerated Update() will work for you.
At those points in time, add additional queries to the TableAdapter and
use them to Update.

If you have never added custom queries to a TableAdapter, this will be
an eye opening exercise in just how flexible the adapter can be (if you
are going to continue to use DataSets, that is).

Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top