UpdateParameters Collection Usage
If you have received any of the following error message regarding the ObjectDataSourceView.ConvertType:
- When receiving dates from browsers that are set with different culture settings
than your server:
Cannot convert value of parameter 'OrderDate' from 'System.String'
- When the user leave a textbox empty when a numeric value was supposed to be entered:
[FormatException: Input string was not in a correct format.]
Then set the ConvertNullToDBNull property of the DataSource control to true and add
an UpdateParameters collection. In this sample I explicity cast the updated values
to their appropriate types:
<UpdateParameters>
<asp:Parameter Name="OrderDate" Type="DateTime" />
<asp:Parameter Name="ShipName" Type="String" />
<asp:Parameter Name="Freight" Type="String" />
<asp:Parameter Name="OrderID" Type="Int32" />
</UpdateParameters>
click here to view the type casting error of this page without
the UpdateParamertes
| Edit | 10643 |
8/25/1997
| 29.4600 | Alfreds Futterkiste |
| Edit | 10692 |
10/3/1997
| 61.0200 | Alfred's Futterkiste |
| Edit | 10702 |
10/13/1997
| 23.9400 | Alfred's Futterkiste |
| Edit | 10835 |
1/15/1998
| 69.5300 | Alfred's Futterkiste |
| Edit | 10952 |
3/16/1998
| 40.4200 | Alfred's Futterkiste |
| Edit | 11011 |
4/9/1998
| 1.2100 | Alfred's Futterkiste |
ObjectDataSource Class Documentation
Using Parameters with the ObjectDataSource Control documentation on the MSDN