Click here to Skip to main content
15,908,661 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Exception Details: System.FormatException: String was not recognized as a valid DateTime.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FormatException: String was not recognized as a valid DateTime.]
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +4588098
   System.Convert.ToDateTime(String value) +66
   frmdemo.btnsave_Click(Object sender, EventArgs e) +137
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981

when i run web site i will works successfully but when i published on local IIS or web server i gives error as above mentioned my MySQL database structure is as follows
SQL
CREATE  TABLE IF NOT EXISTS `db_993bf7_pacecrm`.`demo` (
  `sno` INT(11) NOT NULL ,
  `cientid` VARCHAR(45) NULL DEFAULT NULL ,
  `client` VARCHAR(255) NULL DEFAULT NULL ,
  `org` VARCHAR(255) NULL DEFAULT NULL ,
  `add` VARCHAR(255) NULL DEFAULT NULL ,
  `city` VARCHAR(255) NULL DEFAULT NULL ,
  `mobile` VARCHAR(255) NULL DEFAULT NULL ,
  `demodt` DATE NULL DEFAULT NULL ,
  `demotm` VARCHAR(255) NULL DEFAULT NULL ,
  `product` VARCHAR(255) NULL DEFAULT NULL ,
  `followdt` VARCHAR(255) NULL DEFAULT NULL ,
  `remarks` VARCHAR(255) NULL DEFAULT NULL ,
  PRIMARY KEY (`sno`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;

you can also see error url:http://pacesoftronix-001-site1.smarterasp.net/frmdemo.aspx[^]
please help me to resolve the error.
Posted
Updated 19-Feb-13 20:43pm
v2

1 solution

That's not a database problem. The problem is likely regional settings - with different date formats.
It happens in frmdemo.btnsave_Click, you try to convert a user input to a date - you did not show us that code. Use an appropriate format provider for the DateTime.Parse method.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900