K
Ken Cox [Microsoft MVP]
I've been going around and around on this one. I can't believe that it is
"by design" as Microsoft says.
Here's the situation:
In *declarative* syntax, I'm trying to create a default datetime value for a
SqlDataSource parameter. (I know how to insert this parameter in code. I
want to use declarative markup.)
Here's the declarative markup with ???????? indicating where I'm stumped.
<insertparameters>
<asparameter Name="Title" Type="String"/>
<asparameter Name="Description" Type="String" />
<asparameter Name="DateAdded" Type="DateTime" DefaultValue="????????" />
</insertparameters>
There's a bug report on this dating back to 2004 from my MVP colleague
Frederik Normen. Here's the reply to the bug from the Web Platform and
Tools Team.
"If you specify a type on a Parameter, that type is used to convert the
DefaultValue or Value of the parameter to an object of that type, then the
object itself is added to the Command's parameter collection and it formats
it as you see it in the trace. If you would like full control over the
format of the date sent to the SQL server, type the parameter as a string
and your string-date will be passed to the SQL server untouched."
So I assume that I'd have to change to using the type as a string. But what
should the string look like now? I've tried lots of combinations but haven't
hit the right one.
<insertparameters>
<asparameter Name="Title" Type="String"/>
<asparameter Name="Description" Type="String" />
<asparameter Name="DateAdded" Type="String" DefaultValue="????????" />
</insertparameters>
I'm hoping that I'm just missing something simple on this and someone will
give me a boot in the right direction.
Ken
Microsoft MVP [ASP.NET]
"by design" as Microsoft says.
Here's the situation:
In *declarative* syntax, I'm trying to create a default datetime value for a
SqlDataSource parameter. (I know how to insert this parameter in code. I
want to use declarative markup.)
Here's the declarative markup with ???????? indicating where I'm stumped.
<insertparameters>
<asparameter Name="Title" Type="String"/>
<asparameter Name="Description" Type="String" />
<asparameter Name="DateAdded" Type="DateTime" DefaultValue="????????" />
</insertparameters>
There's a bug report on this dating back to 2004 from my MVP colleague
Frederik Normen. Here's the reply to the bug from the Web Platform and
Tools Team.
"If you specify a type on a Parameter, that type is used to convert the
DefaultValue or Value of the parameter to an object of that type, then the
object itself is added to the Command's parameter collection and it formats
it as you see it in the trace. If you would like full control over the
format of the date sent to the SQL server, type the parameter as a string
and your string-date will be passed to the SQL server untouched."
So I assume that I'd have to change to using the type as a string. But what
should the string look like now? I've tried lots of combinations but haven't
hit the right one.
<insertparameters>
<asparameter Name="Title" Type="String"/>
<asparameter Name="Description" Type="String" />
<asparameter Name="DateAdded" Type="String" DefaultValue="????????" />
</insertparameters>
I'm hoping that I'm just missing something simple on this and someone will
give me a boot in the right direction.
Ken
Microsoft MVP [ASP.NET]