Datagrid help needed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone try and explain detail to me of how they would begin to tackle
the following scenario:

I would like to display two EDITABLE datagrids:

1. The "master grid" - contains people's information - name, title, job
description, etc. Some of these columns will be IDs to other lookup-type
tables (such as Title) and I will want to display the text of and allow
editing via drop-down.

2. The "detail grid" - contains the email address information for the
person selected in the current row above. This, too has columns containing
IDs to other lookup-type tables (such as what report gets sent to this e-mail
address).

Before I brainwash anyone by explaining the ways I've attempted to do this
(to no avail), I was hoping someone has done something similar and would shed
some light on how they'd done it in the past. My recurring problems seem to
be dealing with the "autonumber" (ID) columns in the database and retrieving
the SQL Server-generated Identifier used during an Insert/Update of the
"Master" and having that cascade through to the "Detail" children.

Note that many different people could be running this application and adding
records, so we cannot (solely) rely on any autonumbering system that we set
up in the various DataTable columns.
 
Keith,

Why don't you than use the uniqueidentifier, the autonumber will give you
problems now or in future using datasets and datatables. Be aware that there
can be more rows in a datatable, which are updated in a serial way while
getting there identifieers and more people are concurently busy.

With SQLClient it is probably possible, with OleDb I believe that while
using the autonumber you have to do a lot to keep it stable in a multiuser
environement using Datatables.

The uniqueidentifier with the New Guid as that identifier solves all those
problems.

Just my thought,

Cor
 
Hmm, I was hoping it would be something simple I'm missing. If there was a
way to easily get the SQLServer-generated autoincremented number after an
insert; and then a simple way to cascade these into the new child rows of
this new parent row, then my problem would be solved.

I always figured that the dataadapter would be powerful enough to handle
this. I can't believe how much trouble it has when dealing with a simple
one-to-many relationship. I also can't believe that nobody else has had
problems like mine. While I do like the idea of creating a new GUID for each
new row, all the tables are already used in a multitude of other systems -
this isn't a new set of data, unfortunately.
 
Keith,

Maybe did I understand you wrong, you can do it using the autonumber.

If you do a cascade update than you have to do

First an update of the deleted child rows (If you have not in your database
on cascade delete)
Than the update of the master
Than the update of the added and changed child rows.
The most important things which you thanb have than to know is on this page.

http://msdn.microsoft.com/library/d...lrfsystemdatadatasetclassgetchangestopic2.asp

Because that you are doing updates with the copy getchanges, do you have to
do an acceptchanges at the end.

I hope this helps,

Cor
 
Thank you. This link explains exactly what I'm looking for (even though I
don't really understand some of the code). The only difference will be that
I will have to generate my own SQLCommands for Delete/Update/Insert, since
both my master datatable and child datatable will be created using inner
joins on outside lookup tables (and the SQLCommandBuilder doesn't support
DataTables that were created using multiple database tables).

Here's to hoping it works!
 
Back
Top