I started to prepare to MCTS 70-515 exam (Web Applications Development with Microsoft .NET Framework 4). I’ll publish here my notes and some information you may find usefull. The notes are based on MS Press book: “MCTS Self-Paced Training Kit (Exam 70-515): Web Applications Development with Microsoft .NET Framework 4″. However, I’ll try to add some more information (links, code examples), because some topics in book are only mentioned, but not explained in details.
When an error occurs during generation a report, the error message doesn’t say much:
Failed to retrieve data from the database.
Details: [Database Vendor Code: 295 ]
How to retrive the error message? You have to select from sysmessages table in Sql Server database. In this example:
1 | SELECT * FROM master.dbo.sysmessages WHERE error = 295 |
The query gives the error description:
Today I encountered some problem. In one application two values were to be subtracted. In the source code I’ve found statement:
1 | return Value1 ?? 0 - Value2 ?? 0; |
what is wrong with it? The answer is: opertor precedence! The null-coalescing (??) operator has lower precedence than subtraction operator. The correct code is of course:
1 | return (Value1 ?? 0) - (Value2 ?? 0); |
I wanted to write a post in which I describe in detail the TimeSpan class. I have found this great post in which most of things are described.
Recently I needed a function that return random date. I haven’t found anything that meet my needs. I’ve finally found the article from Tawani’s blog which presents rather long function. However, I like to keep things simple, so I decided to write my own.