S
Steve Lloyd
Hi,
I am using an objectdatasource to control a formview and have an update
command set.
The problem is that when i call the update command I get an Error
"Cannot convert value of parameter 'DateDue' from 'System.String' to
'System.DateTime'"
Two of the update fields are dates and I am entering them in dd/mm/yyyy
format, they work fine in mm/dd/yyyy but this is not what I need.
I have tried forcing the parameters to use the DateTime like explained in
http://www.webswapp.com/codesamples/aspnet20/updateparameters/error.aspx but
I still get the error. Can anyone help?
these are the text boxes in my update template
<asp:TextBox ID=TextBoxCreatedEdit Width=100px CssClass=textboxsmall
runat=server Text='<%# Bind("DateEntered", "{0:dd/MM/yyyy}")
%>'></asp:TextBox>
<asp:TextBox ID=TextBoxDueEdit Width=100px CssClass=textboxsmall
runat=server Text='<%# Bind("DateDue", "{0:dd/MM/yyyy}") %>'></asp:TextBox>
Here is the object DataSource
<asp:ObjectDataSource ConvertNullToDBNull=True
ID="ObjectDataSourceTaskdetails" runat="server"
DataObjectTypeName="LaxeyPartners.Tradelog.Components.Tasks.TaskDetails"
DeleteMethod="RemoveAt" InsertMethod="Add" SelectMethod="GetItems"
TypeName="LaxeyPartners.Tradelog.Components.Tasks.TaskCollection"
UpdateMethod="Update">
<DeleteParameters>
<asparameter Name="index" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name=DateDue Type=DateTime ConvertEmptyStringToNull=true />
<asparameter Name=DateEntered Type=DateTime ConvertEmptyStringToNull=true
/>
</UpdateParameters>
</asp:ObjectDataSource>
Thanks for any help you can give
I am using an objectdatasource to control a formview and have an update
command set.
The problem is that when i call the update command I get an Error
"Cannot convert value of parameter 'DateDue' from 'System.String' to
'System.DateTime'"
Two of the update fields are dates and I am entering them in dd/mm/yyyy
format, they work fine in mm/dd/yyyy but this is not what I need.
I have tried forcing the parameters to use the DateTime like explained in
http://www.webswapp.com/codesamples/aspnet20/updateparameters/error.aspx but
I still get the error. Can anyone help?
these are the text boxes in my update template
<asp:TextBox ID=TextBoxCreatedEdit Width=100px CssClass=textboxsmall
runat=server Text='<%# Bind("DateEntered", "{0:dd/MM/yyyy}")
%>'></asp:TextBox>
<asp:TextBox ID=TextBoxDueEdit Width=100px CssClass=textboxsmall
runat=server Text='<%# Bind("DateDue", "{0:dd/MM/yyyy}") %>'></asp:TextBox>
Here is the object DataSource
<asp:ObjectDataSource ConvertNullToDBNull=True
ID="ObjectDataSourceTaskdetails" runat="server"
DataObjectTypeName="LaxeyPartners.Tradelog.Components.Tasks.TaskDetails"
DeleteMethod="RemoveAt" InsertMethod="Add" SelectMethod="GetItems"
TypeName="LaxeyPartners.Tradelog.Components.Tasks.TaskCollection"
UpdateMethod="Update">
<DeleteParameters>
<asparameter Name="index" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name=DateDue Type=DateTime ConvertEmptyStringToNull=true />
<asparameter Name=DateEntered Type=DateTime ConvertEmptyStringToNull=true
/>
</UpdateParameters>
</asp:ObjectDataSource>
Thanks for any help you can give