Skip to main content

Posts

Showing posts from June, 2013

Get Identity value of the recently added record

The below three built-in functions can be used to get the identity of the mostly added record. @IDENTITY It returns the last identity value generated for any table in the current session, across all scopes. Let me explain this... suppose we create an  insert  trigger on table which inserts a row in another table with generate an identity column, then  @@IDENTITY  returns that identity record which is created by trigger.

Date Formatting Cheat Sheet in C#.Net

Syntax: <%= String.Format("{specifier}", DateTime.Now) %> Specifier Description Output d Short Date 8/4/2007 D Long Date 8-Apr-07 t Short Time 21:08 T Long Time 21:08:59 f Full date and time 4/8/2007 21:08 F Full date and time (long) 4/8/2007 21:08 g Default date and time 8/4/2007 21:08 G Default date and time (long) 8/4/2007 21:08 M Day / Month 8-Apr r RFC1123 date Sun, 08 Apr 2007 21:08:59 GMT s Sortable date/time 2007-04-08T21:08:59 u Universal time, local timezone 2007-04-08 21:08:59Z Y Month / Year Apr-07 dd Day 8 ddd Short Day Name Sun

VBScript equivalent string functions in C#.Net

C# Method VBScript Description IndexOf() InStr Returns the position of the first occurrence of one string within another. The search begins at the first character of the string - InStrRev Returns the position of the first occurrence of one string within another. The search begins at the last character of the string ToLower() LCase Converts a specified string to lowercase SubString() Left Returns a specified number of characters from the left side of a string Length() Len Returns the number of characters in a string TrimStart() LTrim Removes spaces on the left side of a string TrimEnd() RTrim Removes spaces on the right side of a string Trim() Trim Removes spaces on both the left and the right side of a string SubString() M

Asp.Net Xml Exceptions Cheat Sheet

Exception Description UpaException XmlException Returns detailed information about the last exception. XmlSchemaException Returns detailed information about the schema exception. XmlSchemaInferenceException Returns information about errors encountered by the System.Xml.Schema.XmlSchemaInference class while inferring a schema from an XML document. XmlSchemaValidationException Represents the exception thrown when XML Schema Definition Language (XSD) schema validation errors and warnings are encountered in an XML document being validated. XPathException Provides the exception thrown when an error occurs while processing an XPath expression. XsltCompileException The exception that is thrown by the Load method when an error is found in the XSLT style sheet. XsltException The exception that is thrown when an error