Your basic premise is flawed. You want to send only those parameters
to the database which have changed values. As such you can never be
sure which parameters will be supplied to the SP. I would suggest that
you always send all of them... Then your whole problem will evanesce !
(I couldn't resist that one... I'm listening to Evanescence right
now ;-))

Your record exists as a concrete unit... It doesn't make sense to
update some columns and not update some others. If your user keeps
some fields blank/unchanged, it should be assumed that he wants them
to be blank/unchanged. Keeping old data in the database would result
in inconsistency.

Imagine a situation where the "Complainant" provided a Phone number
during record creation. Now, this Complainant has no active Phone
number... he wants that record blank. When the record needs to be
updated, your code will not overwrite the Phone number column and
force him to use a hack such as entering blank spaces into the textbox
to get the data updated in the database.

I would rewrite your "two cases" as :

------------------------------------------------------------------------
1)if the record in textbox is changed,then in that case:
  ***OldValues shud be replaced with NewValues***
-------------------------------------------------------------------------
2)if the record in textbox is not changed,then in that case:
  ***OldValues are equivalent to NewValues and can be safely
replaced***
-------------------------------------------------------------------------

If you must persist with your design, its elementary SQL again... Use
something like the following statement :

SET
[ComplainerName] = ISNULL(@ComplainerName, [ComplainerName]),
...
...


On Jan 20, 8:32 pm, "m...@ni" <[email protected]> wrote:
> but the thing is that,when i click on "edit button",then all the data,
> which is
> coming from database, are seen in the textbox's(in edit mode),now if
> the user
> either made changes in all data or in few data,then all the records
> need to updated.
> There are two cases i.e
> ------------------------------------------------------------------------
> 1)if the record in textbox is changed,then in that case:
>   ***OldValues shud be replaced with NewValues***
> -------------------------------------------------------------------------
> 2)if the record in textbox is not changed,then in that case:
>   ***OldValues shud be replaced with OldValues***
> -------------------------------------------------------------------------
> I dont think so, that this thing is achieved,as you said that
> make there default as null,but by doing so everything will spoil.

Reply via email to