ADO.Net; Smart Client; Web service - Dataset
From: GrantS (sutcliffe_grant_at_hotmail.com)
Date: 08/26/04
- Next message: Jenny Yellman: "Nothing is random"
- Previous message: Terry Kreft: "Re: Renumbering MS db ID?"
- Messages sorted by: [ date ] [ thread ]
Date: 26 Aug 2004 15:26:22 -0700
Hi
I have three issues I am trying to get my head around. Reading the
Microsoft road map for databound Winforms did not provide much help to
me where one needs to insert new rows of data:
I am trying to write a Winforms application in C# with smart client
functionality (offline). The application references a web service
through which the data is accessed and upated. The textbox controls on
the Winform are databound [firstname, surname, address, suburb, city].
This is written in Vis studio 2003.
# Issue 1.
When attempting to add a new Person, I am clearing all the data bound
textboxes via code. I then manually type new values for the new
person. Then I am saving (=Adding a new row to the Datatable [in
code]).
My question is: Given that the controls are databound (and lets assume
I had scrolled to record 4 befoer attempting to add the new person),
by clearing the existing text in the controls and then typing in new
values; then adding the row to the datable, am I creating problems
because the controls were actually bound to record 4. Therefore, even
through the new row is added to the datatable, record 4 will now have
values change (to those just inserted - because the controls are
databound.
# Issue 2.
Hopefully someone can assist me in trying to get a pointer in using
ADO.NET Datasets retrieved through web services where there are
database table relationships. For example - Person database table and
Address database table. These database tables are joined by personID
column common to both (the PK of Person table). Suburb table is
similarly joined to Address table on SuburbID and likewise for City.
The dataset will be supporting editing and insertions through using
the commandbuilder object.
Is the best practice to return the data from these database tables as
one ADO.Net datatable in the dataset [ie for each person the names,
adress, suburb and city] or keep them as separate datatables [Names =
table [0]; address - table [1] etc] in the dataset?
In the former situation the commandbuilder I imagine will do the
updates and insertions in one hit (as long as the associated update or
insert stored procedure is configured for this) for each database
table. In the latter situation, these functions will be done
separately committing each datatable to the respective database table.
Considering that I am writing this for Offline use, I will be needing
to persist the data to the local PC (xml files). This might influence
the strategy needed for my situation.
#Issue 3.
Given that I will be working with offline and will permit insertions.
What is the best way to manage Row uniqueness. If the database uses
auto-incrementing values for my Primary Key (PersonID) in the person
table, and if rows are inserted into the dataset in the offline mode,
these new additions in the dataset will have auto-incremented
PersonIDs which might not match the database as it might have had rows
inserted by some other user working on-line in the interim.
Is using auto incrementing keys OK in the database in this scenario if
the "transfer" of the PersonID from the uncommited dataset is not
utilized in the stored procedure performing the actual database
insertion. Rather the database is left to handle the PersonID new
value and then the Dataset is refreshed back to the connected client
to synchronize.
Heck there is a lot in there!!. If I can get ontop of this lot, I will
be flying.
Thanks in advance.
Grant
- Next message: Jenny Yellman: "Nothing is random"
- Previous message: Terry Kreft: "Re: Renumbering MS db ID?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|