Fórmulas e Cenas

Object Reference Not Set to an Instance of an Object

  Home  |   Contact  |   Syndication    |   Login
  45 Posts | 0 Stories | 15 Comments | 0 Trackbacks

News

Archives

Post Categories

Links

February 2010 Entries

Sometimes we find some code that... well.... I guess someone must be really REALLY high to write...

 

The WTF way

DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("dd-MM-yyyy")

 

The right way:

 

DateTime.Now.ToString("dd-MM-yyyy")

 

 

 


I think it's common knowledge that timeouts can be set on connection strings to ensure that a certain connection doesnt say open for more than SSS seconds. What is not so common knowledge is the fact that on a transaction every single command has its own timeout value and if exceded it can bring down the entire transaction. So when using transactions take in mind that you can set the connection timeout to 20 minutes, but if a single command that takes a few extra seconds can timeout. To prevent this ......

Response.Clear();Response.C... = "application/pdf";Response.... "attachment;filename=\"File... SourceEnjoy :) ......