You are trying to set the DefaultValue
on
SqlDataSource2.UpdateParameters("actualTestResultDate").DefaultValue
to a null or minimum value?
?
On 4/5/06, orangefluffybun <[EMAIL PROTECTED]> wrote:
> Hi, Please help. Thanks in advance!
>
> I tried all of the following. The error messages are right below each
> method.
>
> I think it has to do with other area of the page and codebehind. I am
> performing the null assignment in
> Protected Sub FormView1_ItemUpdating(ByVal sender As Object, ByVal e
> As System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles
> FormView1.ItemUpdating
>
> My default mode of FormView1 is "Edit" and it's service as a detail
> (editing) form of the parent (a GridView control). FormView1 is
> populated when the Select button is clicked on a given record in the
> GridView control.
>
> I even tried it w/ a textbox item in the same event, but the data
> never did get updated into the db! I have similar code working in
> another page where there is only a FormView Control and have
> 'SqlDataSource1.InsertParameters("createdon").DefaultValue = Date.Now'
> working.
>
> SqlDataSource2.UpdateParameters("updateName").DefaultValue =
> "xxxxxxxxxxxxxxxxxxx"
> Response.Write("<br>after: " &
> SqlDataSource2.UpdateParameters("updateName").DefaultValue)
>
> Why why why do they behave differently?
> '================================================
> 'Dim sqldatenull As SqlDateTime = SqlDateTime.Null
> ':err: Object cannot be cast from DBNull to other types.
>
> 'Dim sqldatenull = System.DBNull.Value
> ':err: Conversion from type 'DBNull' to type 'String' is not valid.
>
> 'SqlDataSource2.UpdateParameters("actualTestResultDate").DefaultValue
> = DateTime.MinValue
> ':err: Object cannot be cast from DBNull to other types.
>
> 'SqlDataSource2.UpdateParameters("actualTestResultDate").DefaultValue
> = Convert.ToDateTime("1/1/1900")
> ':err: Object cannot be cast from DBNull to other types.
>
> '-----------------
> <asp:FormView ID="FormView1" runat="server" DataKeyNames="TaskID"
> DataSourceID="SqlDataSource2"
> DefaultMode="Edit">
> .....
> '-----------------
> <asp:SqlDataSource ID="SqlDataSource2" runat="server"
> ConnectionString="<%$ ConnectionStrings:aSysConnectionString %>"
> SelectCommand="sp_oneTaskRec"
> SelectCommandType="storedProcedure"
> DeleteCommand="DELETE FROM [tblTasks] WHERE [TaskID] =
> @TaskID"
> UpdateCommand="UPDATE [tblTasks] SET
> [updateName] = @updateName, [testNeeded] = @testNeeded, [testDuration]
> = @testDuration,
> [Result] = @Result, [testPlan] = @testPlan, [backoutPlan] =
> @backoutPlan, [comment] = @comment,
> [opDate] = @opDate, [opTime] = @opTime, [testResultDueDate] =
> @testResultDueDate,
> [testResultDueTime] = @testResultDueTime, [testResultComment] =
> @testResultComment,
> [actualTestResultDate] = @actualTestResultDate, [actualTestResultTime]
> = @actualTestResultTime,
> [certBy] = @certBy, [certOn] = @certOn, [opID] = @opID
> WHERE [TaskID] = @TaskID">
> <DeleteParameters>
> <asp:Parameter Name="TaskID" Type="Int32" />
> </DeleteParameters>
> <SelectParameters>
> <asp:ControlParameter ControlID="GridView1"
> Name="TaskID" PropertyName="SelectedValue" type="Int32"/>
> </SelectParameters>
> <UpdateParameters>
> <asp:Parameter Name="updateName" Type="String" />
> <asp:Parameter Name="testNeeded" Type="Boolean" />
> <asp:Parameter Name="testDuration" Type="Int32" />
> <asp:Parameter Name="Result" Type="Int32" />
> <asp:Parameter Name="testPlan" Type="String" />
> <asp:Parameter Name="backoutPlan" Type="String" />
> <asp:Parameter Name="comment" Type="String" />
> <asp:Parameter Name="opDate" Type="DateTime" />
> <asp:Parameter Name="opTime" Type="DateTime" />
> <asp:Parameter Name="testResultDueDate" Type="DateTime" />
> <asp:Parameter Name="testResultDueTime" Type="DateTime" />
> <asp:Parameter Name="testResultComment" Type="String" />
> <asp:Parameter Name="actualTestResultDate"
> Type="DateTime" />
> <asp:Parameter Name="actualTestResultTime"
> Type="DateTime" />
> <asp:Parameter Name="certBy" Type="Int32"
> ConvertEmptyStringToNull="true" />
> <asp:Parameter Name="certOn" Type="DateTime" />
> <asp:Parameter Name="opID" Type="Int32" />
> <asp:Parameter Name="TaskID" Type="Int32" />
> </UpdateParameters>
> </asp:SqlDataSource>
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
--
Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNet2/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/