Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing date from SQL Serv with System.Date.Now

Status
Not open for further replies.

rodeomount

Programmer
Sep 25, 2007
50
US

I keep getting an error that states: "Operator '>' cannot be applied to operands of type 'string' and 'string'" when using the following. I'm trying to compare to see if the dtExpire date is greater than todays date. How can I do this in C#?

Code:
if(this.Fields["dtCertExpire"].Value.ToString() > System.DateTime.Now.ToLongDateString())
 
Code:
if ((DateTime)this.Fields["dtCertExpire"].Value > System.DateTime.Now)...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top