Re: Writing updates from a wide DataTable
- From: "William \(Bill\) Vaughn" <billvaRemoveThis@xxxxxxxxxx>
- Date: Thu, 28 Jul 2005 11:33:26 -0700
I would feel uncomfortable too--at one point in time you might want to
restrict IO rights to specific columns or trip over a column that can't be
updated at all.
If you roll your own UpdateCommand, you don't have to set columns you don't
want to set and you can still use a SP. The UpdateCommand can define all 50
Parameters but pass NULL or your own "flag"(you might want to SET some
columns to NULL) that could be used in the SP logic that says not to SET
this column.
Creating your own UPDATE statement on the fly is what ADO classic did--based
on changed columns (one of the Update Criteria property settings). It's not
a bad idea, but moves more schema-dependent logic to the client than I would
typically like to do.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Nigel Norris" <nospam@xxxxxxxxxx> wrote in message
news:e$Xv0t5kFHA.1948@xxxxxxxxxxxxxxxxxxxxxxx
>I have a DataTable with a large number of colums - 50 or more. I'm
>following the recommendations to use stored procedures to apply updates to
>the database, and using the Enterprise Llibrary. So I end up with a stored
>procedure with 50+ parameters, and an Update statement that updates the
>same number of columns. In a typical use case only a few columns will
>actually be updated, but my DAL generally doesn't know which - it just gets
>a DataSet with some changes.
>
> Everything works fine, but I feel uncomfortable with this solution. I
> don't like rewriting all those columns I haven't changed. I don't like
> shipping all this unchanged data around.
>
> Should I feel uncomfortable? Are there better ways of handling this kind
> of situation?
>
> Thanks...
>
> --------
> Nigel Norris
>
.
- Follow-Ups:
- Re: Writing updates from a wide DataTable
- From: Sahil Malik [MVP]
- Re: Writing updates from a wide DataTable
- References:
- Writing updates from a wide DataTable
- From: Nigel Norris
- Writing updates from a wide DataTable
- Prev by Date: Re: Writing updates from a wide DataTable
- Next by Date: Re: Few Questions in C#
- Previous by thread: Re: Writing updates from a wide DataTable
- Next by thread: Re: Writing updates from a wide DataTable
- Index(es):
Relevant Pages
|