Hello Group,
(tech: C#, VS2005)
I'm facing a problem in passing Nullable<DateTi meto a webservice.
Below is code in webservice wrapper (reference.cs) used set/get date.
When i set date value
WS.PropertyDate Time = DateTime.Now();
WS.Execute(); //call webmethod
The code fails saying "Date value is of wring type".
private System.Nullable <DateTimemyDate Time;
[System.Xml.Seri alization.XmlEl ementAttribute( IsNullable=true )]
public System.Nullable <DateTimeProper tyDateTime {
get {
return this.myDateTime ;
}
set {
this.myDateTime = value;
}
}
But when i remove System.Nullable everything works fine without any
error.
Code:
private DateTime myDateTime;
[System.Xml.Seri alization.XmlEl ementAttribute( IsNullable=fals e)]
public DateTime PropertyDateTim e {
// same code as above
}
So, here are my questions:
1) Is it advisable to change code in webservice wrapper class
(referrence.cs)
2) if Not then how can solve this problem.
I tried passing date in various formats, used xmlConvert, setting
(IsNullable=fal se) in client class using propertyInfo etc. But nothng
helped.
Please suggest.
-Thanks
(tech: C#, VS2005)
I'm facing a problem in passing Nullable<DateTi meto a webservice.
Below is code in webservice wrapper (reference.cs) used set/get date.
When i set date value
WS.PropertyDate Time = DateTime.Now();
WS.Execute(); //call webmethod
The code fails saying "Date value is of wring type".
private System.Nullable <DateTimemyDate Time;
[System.Xml.Seri alization.XmlEl ementAttribute( IsNullable=true )]
public System.Nullable <DateTimeProper tyDateTime {
get {
return this.myDateTime ;
}
set {
this.myDateTime = value;
}
}
But when i remove System.Nullable everything works fine without any
error.
Code:
private DateTime myDateTime;
[System.Xml.Seri alization.XmlEl ementAttribute( IsNullable=fals e)]
public DateTime PropertyDateTim e {
// same code as above
}
So, here are my questions:
1) Is it advisable to change code in webservice wrapper class
(referrence.cs)
2) if Not then how can solve this problem.
I tried passing date in various formats, used xmlConvert, setting
(IsNullable=fal se) in client class using propertyInfo etc. But nothng
helped.
Please suggest.
-Thanks