PC Review


Reply
Thread Tools Rate Thread

DataGridView / who to update tables with FKs

 
 
Christopher Schlüter
Guest
Posts: n/a
 
      14th Oct 2009
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

 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      15th Oct 2009
Christopher Schlüter <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> 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! |
*******************************************
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGridView multiple tables Tony Microsoft C# .NET 3 26th Jun 2009 03:41 AM
Refreshing Linq query to update second DataGridView when position in first DataGridView changes Arved Sandstrom Microsoft C# .NET 1 25th May 2008 04:06 AM
Flatten two tables in DataGridView? Burt Microsoft C# .NET 1 27th Apr 2007 03:41 PM
How to join tables in a DataGridView???? Mark Microsoft VB .NET 1 31st May 2006 07:19 PM
Columns from two tables in one datagridview row Paul Craig Microsoft ADO .NET 2 30th Mar 2006 11:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:50 AM.