i have try n try n try n again...
iam using mysql db n c# 2.0 n Nhibernate 1.2GA
i have table/entity "tblPriode" that have field "Begin" and the type is "Date"
now i want to delete the table tblPriode where Begin < DateTime.Today
i was try query like this with no syntax error but no row in tblPriode is deleted :
-----------------------------------------------
DateTime lessToDelete = new DateTime(2007,10,18);
ISession session = GetSession();
session.Delete("FROM tblPriode p WHERE (p.Begin < "+lessToDelete.ToShortDateString()+")");
session.Flush();
or
ISession session = GetSession();
session.Delete(string.Format("FROM tblPriode p WHERE (p.Begin < {0:yyyy/MM/dd})",lessToDelete)); /// or switch to {0:dd/MM/yyyy} or add the quota '{0:dd/MM/yyyy}'
session.Flush();
please help,,
|