Date format is not changing

C

CreativeMind

hi all, i m using these lines of code in my program. but when i
deploy , the live server machine doesn't change date format.

IFormatProvider culture=new CultureInfo("en-GB",true);

string a=string.Empty;

DateTime FromEntryDate=Convert.ToDateTime("01/01/1900");

if( txtStartEntryDate.Text.Trim()!=""){
a=txtStartEntryDate.Text;
FromEntryDate =
DateTime.Parse(a,culture,DateTimeStyles.NoCurrentDateDefault);
//
FromEntryDate=DateTime.Parse(FromEntryDate.ToString("MM/dd/yyyy"), new
CultureInfo("en-US").DateTimeFormat);
}

strSQL = string.Format("exec spSearchProperties @RefNo ='{0}',
@OwnerName = '{1}',@LocationId={2},@ProjectId
={3},@SortofId={4},@SellingAgentId={5},@Status='{6}',@StartEntryDate='{7}'",
RefNo,OwnerName.ToString().Trim(),
LocationId, ProjectId, UnitTypeId,this.cboSellingAgent.SelectedValue,
Status,FromEntryDate.ToString("MM/dd/yyyy"));

objDAM.GetDataTable(strSQL,CommandType.Text, ref table);

Trace.Warn(strSQL);

--------------------

trace.warn gives following out put which is working fine but on local
server.

exec spSearchProperties @RefNo ='', @OwnerName =
'',@LocationId=0,@ProjectId
=0,@SortofId=0,@SellingAgentId=0,@Status='0',@StartEntryDate='05/13/2008'

--------------------

but on deployment , trace.warn shows following line that is not
required, i want to get @StartEntryDate='05/13/2008', how can i get
that value.

exec spSearchProperties @RefNo ='', @OwnerName =
'',@LocationId=0,@ProjectId
=0,@SortofId=0,@SellingAgentId=0,@Status='0',@StartEntryDate='13/05/2008
00:00:00'
thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top