What about using the System.Data.Linq
namespace and its SqlMethods.DateDiffMonth
method?
For example, say:
DateTime starDT = {01-Jul-2009 12:00:00 AM}
DateTime endDT = {01-Nov-2009 12:00:00 AM}
Then:
int monthDiff = System.Data.Linq.SqlClient.SqlMethods.DateDiffMonth(startDT, endDT);
==> 4
There are other DateDiff
static methods in the SqlMethods
class.