V
virendra.chandra
hi guys,
this is virendra.
I am in big trouble to handle date situation using where clause. i am
using ormapper.
if the sqlserver and application server has different date
format(different culture) then i am getting a error. datetime overflow.
How i can handle this situation.
ex:
DateTime _fromdate=new DateTime(2005,10,10);
DateTime _todate=DateTime.Now;
1.
string where= "CreateDate between '"+ _fromdate + "' and '" + _todate +
"'";
2.
string where= "CreateDate between '" +
DateTime.ParseExact(_fromdate.ToString(), "MM/dd/yyyy" ,
DateTimeFormatInfo.InvariantInfo)+ "' and '" +
DateTime.ParseExact(_todate.ToString(), "MM/dd/yyyy" ,
DateTimeFormatInfo.InvariantInfo) + "'";
this is virendra.
I am in big trouble to handle date situation using where clause. i am
using ormapper.
if the sqlserver and application server has different date
format(different culture) then i am getting a error. datetime overflow.
How i can handle this situation.
ex:
DateTime _fromdate=new DateTime(2005,10,10);
DateTime _todate=DateTime.Now;
1.
string where= "CreateDate between '"+ _fromdate + "' and '" + _todate +
"'";
2.
string where= "CreateDate between '" +
DateTime.ParseExact(_fromdate.ToString(), "MM/dd/yyyy" ,
DateTimeFormatInfo.InvariantInfo)+ "' and '" +
DateTime.ParseExact(_todate.ToString(), "MM/dd/yyyy" ,
DateTimeFormatInfo.InvariantInfo) + "'";