Calculated columns based on date in typed Dataset

  • Thread starter Thread starter Robert Bravery
  • Start date Start date
R

Robert Bravery

HI All,

I am looking for a way to create some calculated columns in my typed
dataset (VS 2005). This must be based on a datetime column in an SQL2005
table. The calculated column should return the char month of the date, and
another column, the year on the date.
Can anyone suggest a good way, and or point me in the right direction


Thanks
RObert
 
Have you tried adding the Serializable attribute?


See example below. You need to "attribute up" both the base class, and
subclass.





using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;



namespace MyCompany.MyApplication
{

[Serializable]
[DataContract]
public class HelpDeskTicketDifficulty
{

[DataMember]
private Guid _helpDeskTicketDifficultyUUID;

[DataMember]
private int _helpDeskTicketDifficultyID;

[DataMember]
private string _helpDeskTicketDifficultyName = string.Empty ;


public HelpDeskTicketDifficulty() { } //unnecessary, but a
placeholder

public HelpDeskTicketDifficulty(System.Guid
helpDeskTicketDifficultyUUID, int helpDeskTicketDifficultyID, string
helpDeskTicketDifficultyName)
{
this._helpDeskTicketDifficultyUUID =
helpDeskTicketDifficultyUUID;
this._helpDeskTicketDifficultyID = helpDeskTicketDifficultyID;
this._helpDeskTicketDifficultyName =
helpDeskTicketDifficultyName;
}


#region A

public Guid HelpDeskTicketDifficultyUUID
{
get
{
return this._helpDeskTicketDifficultyUUID;
}
set
{
this._helpDeskTicketDifficultyUUID = value;
}
}


public int HelpDeskTicketDifficultyID
{
get
{
return _helpDeskTicketDifficultyID;
}
set
{
_helpDeskTicketDifficultyID = value;
}
}

public string HelpDeskTicketDifficultyName
{
get
{
return _helpDeskTicketDifficultyName;
}
set
{
_helpDeskTicketDifficultyName = value;
}
}


#endregion

}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top