在 WCF 服务中,我使用 Linq 类。我的代码如下:
AttendenceDataContext projectDataContext=new AttendenceDataContext();
var brAttendence = new BR_Attendance()
{
SupId =1,
AttenDate=from w in projectDataContext.gete,
InTime =,
OutTime =,
ImageName =,
ImageUrl =,
PresentBR =,
AbsentBR =,
Active = true
};
我在 wcf 服务中编写代码,我可以在我的操作合同方法中插入getsysdatefrom 。我的wcf服务代码如下:
namespace ServiceHost
{
[ServiceContract(Namespace = "")]
[SilverlightFaultBehavior]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class UploadService
{
[OperationContract]
public bool Upload(ImageFile image)
{
FileStream fileStream = null;
BinaryWriter writer = null;
string filePath;
try
{
filePath = HttpContext.Current.Server.MapPath(".") + "\\Picture\\" + image.ImageName;
if (image.ImageName != string.Empty)
{
fileStream = File.Open(filePath, FileMode.Create);
writer = new BinaryWriter(fileStream);
writer.Write(image.Imagestream);
}
if (fileStream != null)
fileStream.Close();
if (writer != null)
writer.Close();
AttendenceDataContext projectDataContext = new AttendenceDataContext();
var brAttendence = new BR_Attendance()
{
SupId = 1,
AttenDate = from w in projectDataContext.gete,
InTime =,
OutTime =,
ImageName =,
ImageUrl =,
PresentBR =,
AbsentBR =,
Active = true
};
return true;
}
catch (Exception)
{
if (fileStream != null)
fileStream.Close();
if (writer != null)
writer.Close();
return false;
}
finally
{
}
}
}
}
在AttenDate我想获取 microsoft sql server 当前日期。如何得到它?