473,508 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in passing System.Nullable<DateTime>

Hello Group,

(tech: C#, VS2005)

I'm facing a problem in passing Nullable<DateTimeto a webservice.
Below is code in webservice wrapper (reference.cs) used set/get date.

When i set date value

WS.PropertyDateTime = DateTime.Now();
WS.Execute(); //call webmethod
The code fails saying "Date value is of wring type".

private System.Nullable<DateTimemyDateTime;

[System.Xml.Serialization.XmlElementAttribute(IsNul lable=true)]
public System.Nullable<DateTimePropertyDateTime {
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.Serialization.XmlElementAttribute(IsNul lable=false)]
public DateTime PropertyDateTime {
// 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=false) in client class using propertyInfo etc. But nothng
helped.

Please suggest.

-Thanks

Jul 5 '06 #1
0 4155

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5943
by: ESPNSTI | last post by:
Hi, Please don't shoot me if the answer is simple, I'm new to .Net and C# :) .. I'm attempting to convert a nullable type to it's "non-nullable" type in a generic way (without knowing what...
2
1605
by: js | last post by:
Any way to modify an <asp:Calendar> tag with parameters on the fly? Seems I'm not allowed to use the <% =xxx %> substitution for parameters to the <asp:Calendar> tag. Do I have to do code...
4
2814
by: Alan Silver | last post by:
Hello, I have a user control that has a property StartYear. Logically enough, this takes an Int32 value. I have no problem doing something like ... <ctls:fred id="frdFred" StartYear="2000"...
18
1884
by: Sean | last post by:
I have been using List(of String) when I could easily be using a string array instead. Is it still considered best practice to use Generic list of string rather then a string array? Thanks
3
13894
by: Web learner | last post by:
The following code works fine private List<double> GetDataFor(string column, int selectedYear) { ------- ------- return list; } foreach (double item in GetDataFor("AirTemp", selectedYear))...
0
1117
by: sloan | last post by:
Here is one I've been tinkering around with for a few days. Given the bottom 2 classes and one interface. (at the very bottom) Is there a way to represent EmployeeCollection :...
10
6443
by: lpinho | last post by:
Hi all, I have a class (named for the example myObject) that can be of several types (int, string, float, etc), instead of using a object to define it's type I used a generic. public class...
36
4534
by: Nick | last post by:
Hi there I'm trying to use the IsDaylightSavingTime property of the datetime object. The PC I am using is in GMT, DateTime.Now.IsDaylightSavingTime() returns true...
5
1659
by: Steven | last post by:
I have the following in my web.config: <system.web> <profile defaultProvider="MyASPSqlProfileProvider" enabled="true" > <properties> <add name="FirstName" defaultValue="" type="string"/> <add...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.