should i use property 'OldValuesParameterFormatString'?

  • Thread starter Thread starter Bart
  • Start date Start date
B

Bart

Hi,

i have a gridview which is updateble, using UpdateCommand="UPDATE myfile
set ....
Now i wonder whether i should use the property
'OldValuesParameterFormatString'.
When is it recommended and when not?
Thanks
Bart
 
Hi,

i have a gridview which is updateble,  using UpdateCommand="UPDATE myfile
set ....
Now i wonder whether i should use the property
'OldValuesParameterFormatString'.
When is it recommended and when not?
Thanks
Bart

This property is used to include the original value of the parameter
(for example, when it is a primary key @id, "UPDATE myfile ..... WHERE
id=@id" and @id can be changed by the user)

You would need it in two following scenarios:

- If, when editing a record, users are able to change the primary key
value. In this case, both the new primary key value and the original
primary key value must be provided so that the record with the
original primary key value can be found and have its value updated
accordingly.

- When using optimistic concurrency. Optimistic concurrency is a
technique to ensure that two simultaneous users don't overwrite one
another's changes, and is the topic for a future tutorial.

More at http://www.asp.net/LEARN/data-access/tutorial-16-vb.aspx

Hope this helps
 
thanks
"Alexey Smirnov" <[email protected]> schreef in bericht
Hi,

i have a gridview which is updateble, using UpdateCommand="UPDATE myfile
set ....
Now i wonder whether i should use the property
'OldValuesParameterFormatString'.
When is it recommended and when not?
Thanks
Bart

This property is used to include the original value of the parameter
(for example, when it is a primary key @id, "UPDATE myfile ..... WHERE
id=@id" and @id can be changed by the user)

You would need it in two following scenarios:

- If, when editing a record, users are able to change the primary key
value. In this case, both the new primary key value and the original
primary key value must be provided so that the record with the
original primary key value can be found and have its value updated
accordingly.

- When using optimistic concurrency. Optimistic concurrency is a
technique to ensure that two simultaneous users don't overwrite one
another's changes, and is the topic for a future tutorial.

More at http://www.asp.net/LEARN/data-access/tutorial-16-vb.aspx

Hope this helps
 
Back
Top