Code
using (var ObjectContext = new AgentSystemEntities())
{
DateTime dt = new DateTime(1997, 1, 1);
string entitySQL = "SELECT VALUE Users FROM Users WHERE Users.AddDateTime > @dt;";
ObjectParameter[] ps = { new ObjectParameter("dt", dt) };
ObjectQuery<Users> query = ObjectContext.CreateQuery<Users>(entitySQL,ps);
string message = "执行的语句:" + query.CommandText + "\n\r";
if (query.Count() > 0)
{
message += query.First().UserNames + "\n\r";
}
else
{
message += "没有数据\n\r";
}
MessageBox.Show(message);
}
顺我者昌,逆我者亡.
posted on
2009-10-09 15:01
流氓宝宝
阅读(
281)
评论()
编辑
收藏
举报