WebLog of Ken Cox

Web Links

June 2007 - Posts

Setting a DateTime as the DefaultValue in SqlDataSource asp:parameter

Sometimes you lose way too much time on the stupidest little things. Maybe this post will save someone else some aggravation.

Using *declarative* syntax, I wanted to create a default datetime value for a SqlDataSource insert parameter. I tried all sorts of date-like values but kept getting errors.

I posted my issue to the microsoft.public.dotnet.framework.aspnet newsgroup and got an answer from Microsoft's Walter Wang to use "2007/12/24":

<insertparameters>
 <asp:parameter Name="Title" Type="String"/>
 <asp:parameter Name="Description" Type="String" />
 <asp:Parameter Name="DateAdded" Type="DateTime" DefaultValue="2007/12/24" />
</insertparameters>

That worked.

I'm still working on how to make the DefaultValue the current date using VB declarative syntax.

 

Posted: Jun 19 2007, 10:02 AM by Ken Cox [MVP] | with 7 comment(s)
Filed under: ,
Component Toolsets for WPF and Silverlight Coming

I see where ComponentOne has announced Studio Enterprise for WPF and Microsoft Silverlight‎. They're stepping up to Visual Studio 2008 with Grid, Carousel, Charting, Scheduling and Input components for the new environments.

Can't wait to try these!

Orcas=Visual Studio 2008

I'm just watching Brian Goldfarb on Virtual Tech-Ed referring to Visual Studio 2008. "Orcas" has an official name!

More Posts