Trying to set a value for a create user soap call and when setting a startdate for a new user:
DateTime? dt = DateTime.Now;
emptyUsr.StartDate = dt;
It returns an error of "Cannot implicitly convert type 'System.DateTime' to 'LearnScan.LearnUser.NullableDateTime'" I was under the impression that DateTime? sets to nullable?
The StartDate property has type LearnScan.LearnUser.NullableDateTime which is defined as:
public partial class NullableDateTime : object, System.ComponentModel.INotifyPropertyChanged {
internal static object DateTime;
private bool isNullField;
private System.DateTime valueField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=0)]
public bool IsNull {
get {
return this.isNullField;
}
set {
this.isNullField = value;
this.RaisePropertyChanged("IsNull");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=1)]
public System.DateTime Value {
get {
return this.valueField;
}
set {
this.valueField = value;
this.RaisePropertyChanged("Value");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
*Solution - It wanted values for each emptyUsr.StartDate.IsNull = false and emptyUsr.StartDate.Value= DateTime.Now;
Nullable<DateTime>. The error will point to the offending line and I'd bet it'semptyUsr.StartDate = dt;. What is the type ofStartDate?LearnScan.LearnUser.NullableDateTime(or you change the type of theStartDateproperty toDateTime?).LearnScan.LearnUser.NullableDateTimeto the question, no-one can tell you how to construct one from aDateTime?otherwise.