BizTalk Server General - XS:Datetime to .NET System.DateTime ?

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > November 2004 > XS:Datetime to .NET System.DateTime ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author XS:Datetime to .NET System.DateTime ?
Lars W. Andersen

2004-11-21, 5:48 pm

This works fine for me with C# code, but with C# in an advanced functoid it
tell me I can't pass in an XS:Datetime element.

The element i am passing into the script is of an an XS:Datetime type, and
my script starts like this:
(I am converting it to a string and returning the string)

" public string SQLDate(System.DateTime MyDateTime) ...."

I get an error telling me "XSL transform error: Function
'userCSharp:SQLDate2()' has failed. Object type cannot be converted to
target type."

If I just validate the map it tells me everything is ok.
I only get this error when I test with an instance. The instance is the
output of another Biztalk application and is validated as a proper
XS:datetime element so that should be ok. Shouldnt it?

Have anybody else succeeded in passing in a XS:datetime?
Or am I doing something wrong?

regards
Lars


Denis Demont

2004-11-22, 7:46 am

Hi Lars

In most of case, you have this error because the format of the source is bad.

You must change your function like this :

public string SQLDate(String MyDateTime)
{
DateTime dt = DateTime.Parse(MyDateTime);
..............
return dt.ToString("yyyy-MM-dd");
}

I hope that it solve your problem.

Regards
Denis
"Lars W. Andersen" wrote:

> This works fine for me with C# code, but with C# in an advanced functoid it
> tell me I can't pass in an XS:Datetime element.
>
> The element i am passing into the script is of an an XS:Datetime type, and
> my script starts like this:
> (I am converting it to a string and returning the string)
>
> " public string SQLDate(System.DateTime MyDateTime) ...."
>
> I get an error telling me "XSL transform error: Function
> 'userCSharp:SQLDate2()' has failed. Object type cannot be converted to
> target type."
>
> If I just validate the map it tells me everything is ok.
> I only get this error when I test with an instance. The instance is the
> output of another Biztalk application and is validated as a proper
> XS:datetime element so that should be ok. Shouldnt it?
>
> Have anybody else succeeded in passing in a XS:datetime?
> Or am I doing something wrong?
>
> regards
> Lars
>
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com